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

Structure 'attributes' and 'properties' better, using container-like facades and proxies #574

Open
eyalroz opened this issue Jan 23, 2024 · 0 comments

Comments

@eyalroz
Copy link
Owner

eyalroz commented Jan 23, 2024

Many of our the objects we wrap in the library have all sorts of "attributes" or "properties", with API functions for getting and setting them.

At the moment, we reflect this almost as-is, with set_whatever() and get_whatever() (or just ::whatever() if it's a method) for attributes named "whatever", or set(attribute_enum_t attribute, attribute_value_t value) and get(attribute_enum_t attribute).

This is overly-verbose and non-idiomatic. We should:

  1. Utilize proxies fort such attributes and properties, such that assigning to them triggers a set_ function and using their value triggers a get_.
  2. For the many-attribute case, have a map of these proxies, with each value being the proxy mentioned above; and an ability to access them using an expression such as: my_wrapped_object.attributes[whatever].
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant