Skip to content
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

Confusing use of notify #86

Open
bbros-dev opened this issue Aug 12, 2021 · 4 comments
Open

Confusing use of notify #86

bbros-dev opened this issue Aug 12, 2021 · 4 comments

Comments

@bbros-dev
Copy link

Thank you for all the effort put into Tokio and the mini-redis demonstration project. As well as for making these open source.

Trying to understand Rust, we were confused by the use of the term notify to refer to a Receiver, specifically notify.recv() had us looking twice.

Some dictionaries have listen or collect or gather as antonyms for notify.

We think changing this usage of notify to one of the antonyms may be less puzzling?

@Darksonn
Copy link
Collaborator

Changing it to listen or receiver sounds reasonable to me. I do not think that collect and gather would be good names.

@bbros-dev
Copy link
Author

bbros-dev commented Aug 17, 2021

Thanks for the feedback. We had contemplated receiver but thought for new users, coming from other languages, it might be mistaken as an instance (or some such concept) of Receiver, while from (weak/flawed) memory it is a Future.

We're still working through this example so will likely wait a while before making an PR - to ensure we haven't misunderstood.

For future reference, we also thought this line (signalling is a synonym for sending):

/// Shutdown is signalled using a `broadcast::Receiver`.

might be better phrased:

/// Shutdown signals are monitored via a `broadcast::Receiver`.

Which of course suggests that monitor is a better replacement term for notify?

@Darksonn
Copy link
Collaborator

We had contemplated receiver but thought for new users, coming from other languages, it might be mistaken as an instance (or some such concept) of Receiver, while from (weak/flawed) memory it is a Future.

No, it isn't a Future. It is an instance of the type tokio::sync::broadcast::Receiver.


As for the word "monitor", I find that word very unnatural here. If we are to rephrase the sentence, I would prefer this:

/// Shutdown signals are received using a `broadcast::Receiver`.

@bbros-dev
Copy link
Author

receiver it is then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants