-
Notifications
You must be signed in to change notification settings - Fork 634
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
Replace trait Wakeup
with NotifyHandle
?
#688
Comments
I opted to introduce a new trait instead of using
Given these two points, it seemed to me that it was better to introduce a new trait instead of using |
Can you clarify what the double dispatch problem is? (it's not immediately clear to me where the second one is). Also, was it measured to be a performance hit or a source of slowness? |
The double dyn dispatch point isn't so much a point about performance, but code smell involved with using If you are concerned about trait proliferation, it may make sense to look at For example, does |
Ok, can you still clarify though that the double dispatch is? I know that I'm personally worried about too many traits, yeah, but we can always attempt to curb them with more documentation and examples, so it's not a strong point of objection by any means. I also agree yeah that I originally thought this was going to be required for #690 for eliminating a type parameter but it ended up not being necessary (hence the PR). I then attempted to tackle a separate issue (#697) in testing out a solution but that also required this issue. Attempting to solve #697 in the naive fashion (calling |
A scheduler node implements Today, since the scheduler is generic over Again though, replacing |
What are the actionable items remaining for this issue? |
cc @cramertj @alexcrichton, at some point you were talking about an approach that can avoid allocation and does not need ids. Did that pan out? |
@aturon oh that was part of a grander scheme for reworking the |
Closing as no longer relevant. |
The recent addition of the
Sleep
trait also added an associatedWakeup
trait for the associated type and its method,Sleep::wakeup
, to return. This trait is, however, very similar to theNotify
trait in spirit (modulo the workings with ids). In the spirit of reducing the number of traits we have, could the usage ofWakeup
be replaced withNotifyHandle
?This'd have the added benefit of making
Sleep
more ergonomically object safe and I don't think we'd lose any functionality thatWakeup
offers today. It should buy implementors the flexibility to do what they'd like as well as the users in thefutures
crate to use it in a generic fashion.The text was updated successfully, but these errors were encountered: