-
Notifications
You must be signed in to change notification settings - Fork 75
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
I should be able to modify State's getters and setters for an individual attribute #227
Comments
I'll start working on this actually, it doesn't look too difficult. |
Historically people have set up custom data types for cases like this, and is just the sort of problem that was trying to be solved when custom data types were added. Have you tried that? Or is there some reason why a attribute-level override would be better? |
In my opinion (which may be uninformed) there are two reasons why this solution isn't enough:
|
Your opinion was in fact very informed, and from a very valuable perspective. Please do consider submitting a PR for this. I for one would look forward to it. |
I want to be able to follow some procedure every time an attribute is modified. For example if I wanted a vector object whose x and y components should be interdependent with its polar components, magnitude and direction, I cannot make all four of these numbers derived objects because their interdependence becomes circular. What I would like to do instead is initialize the 'x' prop with a 'set' function, to automatically update the polar coordinates, etc.
Ampersand-State allows you to specify the 'set' behavior for a dataType as a whole, but this only works if I want to modify all 'number' values to have the same setting behavior.
If there is a more trivial way to accomplish what I'm describing, I would be interested.
The text was updated successfully, but these errors were encountered: