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:
Utilize proxies fort such attributes and properties, such that assigning to them triggers a set_ function and using their value triggers a get_.
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].
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()
andget_whatever()
(or just::whatever()
if it's a method) for attributes named "whatever", orset(attribute_enum_t attribute, attribute_value_t value)
andget(attribute_enum_t attribute)
.This is overly-verbose and non-idiomatic. We should:
set_
function and using their value triggers aget_
.my_wrapped_object.attributes[whatever]
.