Is your feature request related to a problem? Please describe.
A DataProperty typed as a dict may have its value changed without triggering __set__. This leads to the property's value becoming out of sync with observers.
Describe the solution you'd like
DataProperty instances that are typed as a mutable object (e.g. dict, list, or a custom class) should either not be observable, or should raise an error when they are defined (or once the type is resolved).
For mapping or sequence types, I think it would be really nice to have the error message suggest typing them as Mapping or Sequence. Type checked code should then not allow mutation of these objects. We could even use a MappingProxy for dict values to ensure they don't get mutated, or convert list to tuple to achieve the same effect.
I think this merits a bit of discussion. Observability isn't something that's used much at the moment, but I can see it becoming important, for example in efficient client implementations. I would be keen to make sure that it works properly.
Describe alternatives you've considered
I've previously attempted to implement a deep reactive dictionary. This does not seem like a good idea: there are far too many things to go wrong.
Is your feature request related to a problem? Please describe.
A
DataPropertytyped as adictmay have its value changed without triggering__set__. This leads to the property's value becoming out of sync with observers.Describe the solution you'd like
DataPropertyinstances that are typed as a mutable object (e.g.dict,list, or a custom class) should either not be observable, or should raise an error when they are defined (or once the type is resolved).For mapping or sequence types, I think it would be really nice to have the error message suggest typing them as
MappingorSequence. Type checked code should then not allow mutation of these objects. We could even use aMappingProxyfordictvalues to ensure they don't get mutated, or convertlisttotupleto achieve the same effect.I think this merits a bit of discussion. Observability isn't something that's used much at the moment, but I can see it becoming important, for example in efficient client implementations. I would be keen to make sure that it works properly.
Describe alternatives you've considered
I've previously attempted to implement a deep reactive dictionary. This does not seem like a good idea: there are far too many things to go wrong.