Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #103
🚧🚧🚧 Work in progress
I'm just starting to get to grips with the complexity of this topic. It's been a long time since I looked at object proxying.
The boilerplate is done.
The main complexity will be in
object_proxy.py
. In particular the challenge is that there's no watertight method of trapping attribute access only, without also trapping method calls. So for examplef.bar
should be reactive.f.quux
should not be reactive (sincef.bar
is already reactive).f.baz
is not stateful, so it doesn't need to be reactive.The list of attributes to trap is dynamic, like the keys of a dict, but we cannot replace the internal
f.__dict__
. All we have to work with is a trap onf.__getattribute__
but that also fires for thef.bar
andf.quux
.Another challenge is that on objects, you can define something like
__iter__
to make a type iterable, while by default classes don't have an__iter__
implementation.🤔🤔🤔💭💭💭 Needs a lot more thought...