Is there a "proper" way in Julia to create a struct that runs an "updating function" whenever one of it's attributes changes? For example:
mutable struct Example
name::String
past_names
end
Now, whenever the name attribute changes, the past_name should append the past name.
you can highjack setproperty!
note that this sort of spook action at a distance can lead to very hard to maintain code
Last updated: Dec 28 2024 at 04:38 UTC