-
Notifications
You must be signed in to change notification settings - Fork 8
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
Add a Receiver.triggered
method
#328
Conversation
Other naming options: |
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.
OK, so the issue we had with TypeGuard
as a member method was not it being a member method but about applying the type guard to self
, this is why we can't do selected.source(receiver)
, because we want to narrow selected
, not receiver
, but when used as a member the variable to narrow is the second argument, not self
.
So receiver.is_selected(selected)
works and will narrow selected. OK. I don't like the fact that now part of
select()is implemented in
Receiverunless we have a considerable improvement in how the code is read, and
receiver.is_selected(selected)doesn't read much better than
selected_from(selected, receiver)`.
But maybe something like receiver.is_source_of(selected)
could work. What do you think?
fc7064a
to
7005e83
Compare
Receiver.is_selected
methodReceiver.matches
method
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
This is an alternative for the `selected_from` method and could eventually replace it. Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
Signed-off-by: Sahas Subramanian <sahas.subramanian@proton.me>
This is an alternative to the
selected_from
method.