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

Book: naming convention for loop functions #106

Open
kachayev opened this issue Aug 24, 2019 · 5 comments
Open

Book: naming convention for loop functions #106

kachayev opened this issue Aug 24, 2019 · 5 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@kachayev
Copy link
Contributor

There are quite a few functions in the book that runs while loop inside as are supposed to be called instead task::spawn. E.g. server, client, client_writer. I think it makes sense to extend those name to explicitly set expectation on loop inside it, like server_loop, client_loop, client_writer_loop. Would be happy to provide PR if that sounds like a helpful change.

Another thought about naming, client function technically is not about "client", it's about "connection". Maybe it should be connection_loop? It makes disconnect handling easier to read.

@skade skade added the documentation Improvements or additions to documentation label Aug 26, 2019
@skade
Copy link
Collaborator

skade commented Aug 26, 2019

We spoke about his after the course and I agree, I think calling the functions loop makes sense. /cc @matklad

@matklad
Copy link
Member

matklad commented Aug 26, 2019

+1

I'd think for server a more specif accept_look might work better.

@matklad
Copy link
Member

matklad commented Aug 26, 2019

@kachayev are you still willing to provide a pull request? ;)

@kachayev
Copy link
Contributor Author

@matklad Absolutely! ;) Will submit PR shortly.

@skade
Copy link
Collaborator

skade commented Aug 26, 2019

@kachayev please also submit one to async-rs/a-chat, it's the reference implementation.

bors bot added a commit to async-rs/a-chat that referenced this issue Sep 2, 2019
7: Rename server functions to follow *_loop convention r=matklad a=kachayev

Described here: async-rs/async-std#106

If new names sound okay, I would submit PR for the book.

Co-authored-by: Oleksii Kachaiev <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants