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

Support Map-like subsref and subsasgn overload for types.untyped.Set types. #409

Open
lawrence-mbf opened this issue Feb 18, 2022 · 7 comments · May be fixed by #413
Open

Support Map-like subsref and subsasgn overload for types.untyped.Set types. #409

lawrence-mbf opened this issue Feb 18, 2022 · 7 comments · May be fixed by #413
Labels
priority: medium non-critical problem and/or affecting only a small set of NWB users status: todo something needs to be done topic: matnwb-api related to improving the matnwb api

Comments

@lawrence-mbf
Copy link
Collaborator

lawrence-mbf commented Feb 18, 2022

Calling get/set all the time isn't quite idiomatic MATLAB.

@bendichter
Copy link
Contributor

this would be cool!

@bendichter
Copy link
Contributor

though let's think about how we would support any names that have spaces in them

@lawrence-mbf
Copy link
Collaborator Author

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;

@lawrence-mbf
Copy link
Collaborator Author

We'd just have to be careful never to accidentally shadow any methods in Set itself (size, fcn, etc.)

@bendichter
Copy link
Contributor

how about nwb.processing.some_data?

@lawrence-mbf lawrence-mbf changed the title Support Map-like subsref overload for types.untyped.Set types. Support Map-like subsref and subsasgn overload for types.untyped.Set types. Feb 18, 2022
@lawrence-mbf
Copy link
Collaborator Author

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).

@bendichter
Copy link
Contributor

ok, sounds like your solution is simpler and less risky

@lawrence-mbf lawrence-mbf linked a pull request Feb 18, 2022 that will close this issue
@ehennestad ehennestad added status: todo something needs to be done topic: matnwb-api related to improving the matnwb api priority: medium non-critical problem and/or affecting only a small set of NWB users labels Oct 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
priority: medium non-critical problem and/or affecting only a small set of NWB users status: todo something needs to be done topic: matnwb-api related to improving the matnwb api
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants