-
Notifications
You must be signed in to change notification settings - Fork 234
[RFC] Rename send
to write
.
#281
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
Conversation
r? @therealprof (rust-highfive has picked a reviewer for you, use r? to override) |
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.
lgtm
This would lead to ambiguous calls for users of the prelude since all traits are pulled in.
Same thing for serial in #280. |
If you look at that "merged" API as a whole, it feels very inconsistent:
I think having equal names for equivalent blocking/nonblocking methods is much clearer. About the naming conflicts:
Given the above, maybe removing the prelude is a good idea, yup. I don't see it adding ergonomic improvements in either hal-agnostic or hal-using code. Also, the Rng traits already have |
The problem only exists for structs implementing the blocking and non-blocking versions of the traits. |
This (and #280) was discussed in last week's and today's WG meetings. Minutes:
The key question is "should different flavors of the same trait use the same method names?". Arguments in favor and against are pretty much the ones already discussed in this thread. One argument against is the prelude, the solution is removing it (#282). |
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.
Looks good to me.
Fort the record, the decisive argument for me was that it would be weird when we have 3 different synonyms for write
, one for blocking, one for nb, one for futures. So it seems better to remove the prelude and disambiguate if necessary.
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.
LGTM
bors r+
282: Remove prelude. r=therealprof a=Dirbaio **DEPENDS on #280** Following discussions in #280 #281, we might want to use the same method names for the `blocking` and `nb` (and in the future, `futures`) trait flavors. In that case, importing the prelude guarantees naming conflicts, so it's better to remove it. An alternative would be splitting the prelude in `blocking` and `nb`. However, users often use blocking trait A and nonblocking trait B at the same time, so they'd end up importing both preludes and having name conflicts anyway. Co-authored-by: Dario Nieuwenhuis <[email protected]>
send
andwrite
are essentially synonymous. All the traits usewrite
, exceptnb::spi::FullDuplex
, which usessend
.This PR renames it to
write
. Instances ofsend
in the docs are also replaced, for consistency.