-
Notifications
You must be signed in to change notification settings - Fork 32
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
Reimplement ObservablePairs and eliminate notify keyword #56
Conversation
The old implementation of ObservablePairs seems unnecessarily complicated. Perhaps more importantly, this change allows us to eliminate the `notify` kwarg of `setindex!`, which should reduce type-diversity and may help reduce latency.
I'd also propose we rename |
Thanks! I agree that your implementation of Pinging @jkrumbiegel because I think some of his Makie code (link) relies on the |
Thanks @piever! So folks are aware, you can update the observable with
to make it easier to control notification manually. (Currently we have |
Base.setindex!(observe(observable), val; notify=notify) | ||
end | ||
|
||
function setexcludinghandlers(observable::AbstractObservable, val, pred=x->true) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know that this is internal, but I guess we could keep something along the lines of
setexcludinghandlers(obs::AbstractObservable, val) = observe(obs).val = val
so that the "silent update" is not done by touching an internal field as in #56 (comment). In particular, the observe(obs)
pattern is needed because Interact widgets are AbstractObservable
s, whose "concrete observable" can be accessed with observe(obs)
. As mentioned in that comment, setindex!
would then just by setexcludinghandlers
followed by notify!
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
Ok, I've just left a small comment (to basically keep a method for the silent update, because accessing the field directly won't work on |
Thanks @piever! |
The old implementation of ObservablePairs seems unnecessarily
complicated. Perhaps more importantly, this change allows us
to eliminate the
notify
kwarg ofsetindex!
, which should reducetype-diversity and may help reduce latency.
EDIT: I also suspect that the current implementation has a bug if you make two pairs, one with
a
andb
and the other withb
andc
and use the same update function for both. This implementation should not suffer from any such problems.