Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Comprehensive bounds checking for event values #154

Open
demberto opened this issue Jun 10, 2023 · 0 comments
Open

✨ Comprehensive bounds checking for event values #154

demberto opened this issue Jun 10, 2023 · 0 comments
Assignees
Labels
enhancement New feature or request events Low-level API
Milestone

Comments

@demberto
Copy link
Owner

Problem

Till 2.2.0, non-DATA events had a value setter. In 2.2.0, I removed event value lazy evaluation entirely.

Now value is an attribute of EventBase. Structs as part of list events or child level structs didn't invoke any setters, as they were just dictionaries.

The earlier property setter failed with a ConstructError or struct.Error which was non descriptive of what really caused it.

Ideas

Make EventBase.value a descriptor again. Instead of doing everything in EventBase ctor, shift the parsing logic to subclasses.

Make this descriptor take in a validator class. For struct-based events, wrap the parsed Container into a special dictionary descriptor which validates every __setitem__ with the correct construct.

List event values could have their own list descriptor wrapper over the struct dictionary descriptors.

@demberto demberto added the events Low-level API label Jun 10, 2023
@demberto demberto self-assigned this Jun 10, 2023
@demberto demberto added this to the 2.3.0 milestone Jun 11, 2023
@demberto demberto added the enhancement New feature or request label Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request events Low-level API
Projects
None yet
Development

No branches or pull requests

1 participant