-
Notifications
You must be signed in to change notification settings - Fork 175
MetaFiled requires length attribute to be present on build #18
Comments
Part of me wants to say "use a |
Interesting question, I haven't looked at PascalString yet to see how that works. |
In a library I created (not open sourced, unfortunately, as it is for my employer), I ended up doing the following. Unlike construct, the syntax for the DSL we ended up creating is more heavily metaclass based:
Variable length fields require either a static length or a length_field parameter. These two are couple on message instances and I can pack a message with the correct length automatically:
The invariant in our system is that when unpacking the length of the next field being unpacked must always be known immediately before it will be unpacked. In most cases this is the case. In other cases (for instance, a delimiter in a chunk) we currently just handle that outside of our library or create a special construct. |
This is more like a question rather an issue. I'd expect MEtaField's related length fiekd to be autopopulated on building a structure, however this does not happen:
Could you explain correct behavior?
The text was updated successfully, but these errors were encountered: