-
Notifications
You must be signed in to change notification settings - Fork 59
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
Improve docs for BlockUntil and waiters #82
Comments
Despite being a maintainer, I don't particularly love That said, "Add a warning/note that BlockUntil doesn't consider calls to Chan, and only reacts to construction/Stop/Reset." is intentional per the comment on I'm supportive of updating/improving the documentation around |
That's intuitive to you because you're a maintainer, and it might be reasonable to assume that most Go programmers would be able to conclude this as well. I'd suggest it's our job as documentation writers to help users of varying experience to build the right models to use our libraries effectively, so I'd personally lean towards explaining this. I might have time in the comings while to contribute updates to the docs, not sure yet. Thanks for all your hard work. |
Make sense. I admit I have a lot of... I guess the term is "maintainer bias"(?) Happy to accept contributions, particularly on documentation because of that bias. |
The docs don't sufficiently explain the behavior of BlockUntil, at least when it comes to using Timers and Tickers.
I've found the behavior of BlockUntil for After and Sleep to be intuitive due to their blocking nature.
I'd be pleased to take a stab at contributing these improvements, but I wanted to check-in first to get a read on the attitude of the maintainers towards both the behavior of BlockUntil, and general documentation philosophy.
Existing Documentation
Here are the existing references to BlockUntil in the docs:
Here are the existing references to waiters in the docs:
Example of Undocumented Behavior
When I was recently using BlockUntil with Timer, I discovered that creating a NewTimer immediately created a waiter, rather than say, the call to the Chan. When I went to the docs to understand more, it was hardly discussed.
Here's some example code that I initially found unexpected, which I'd like the documentation to explain:
Similarly, explaining how Stop deregisters a waiter, and Reset reregisters it again.
Again, for Tickers I haven't tested it, but my understanding is that a Ticker behave similarly wrt to Stop and Reset.
Suggested Improvements
Doing all of the following may be overkill, but here are some ideas:
The text was updated successfully, but these errors were encountered: