-
Notifications
You must be signed in to change notification settings - Fork 542
Description
Accessing a variable length SBE property modifies the state of the auto-generated SBE classes by advancing an offset field. Client code has to access every variable length property exactly once, in order. It's common to pass around lists or strings whose length we can't know ahead of time; in such cases SBE client code is brittle and hard to debug.
Could you add in optional runtime checks that validate that getters / setters of variable-length properties are called in the correct order? These would do the following:
- If enabled:
- Register calls that access variable length properties
- If variable length properties are accessed out of order, throw an exception with a diagnostic error message
- In disabled:
- Do nothing. Ideally, don't even compile the code which enforces the check
The checks would be either enabled / disabled at compile time. I would anticipate using them in debug builds (used in development work / some continuous integration plans) and disabling them in release builds (used in production), but other users might want to enable them in different contexts.