matnwb
matnwb copied to clipboard
Support Map-like `subsref` and `subsasgn` overload for `types.untyped.Set` types.
Calling get
/set
all the time isn't quite idiomatic MATLAB.
this would be cool!
though let's think about how we would support any names that have spaces in them
Since Sets are already backed by containers.Map
there isn't an issue in storing. We would just have to imitate its method for mapping string keys to values:
value = nwb.processing('some data');
nwb.processing('some data') = SomeType;
We'd just have to be careful never to accidentally shadow any methods in Set itself (size
, fcn
, etc.)
how about nwb.processing.some_data
?
That would require changing the internals of the Set
to use Dynamic Properties instead. I don't think you can do this with subsref and subsasgn. It would also require a separate cache which saves the property's true name as well as checking for strange collisions like a Set with the properties (some data
, some-data
, and some_data
).
ok, sounds like your solution is simpler and less risky