sync: outdated referenced documentation in `Cond`
The documentation for sync.Cond suggests referring to Roberto Clapis's series on advanced concurrency patterns for more details, but these materials, specifically concerning concurrency, are from 2019. Specifically:
-
Go advanced concurrency patterns: part 2 (timers) discusses issues with
time.Timerthat have been resolved in version 1.23, and possibly even earlier versions. -
Go advanced concurrency patterns: part 3 (channels) explains how
TryLockandTryRLockcan be implemented, which have since become part of the standard library.
In my humble opinion, I like seeing the reference to gophercon talks in the source code because it enhances the documentation, which is often lacking, and even if the std lib has changed since the date of the talk, the talk is still useful and I'm hardly misled by it.
@golang/runtime per owners -- any opinions on this issue?
I looked over the two links your pointed out, and I think it's OK to leave it as-is.
- Go advanced concurrency patterns: part 2 (timers) discusses issues with
time.Timerthat have been resolved in version 1.23, and possibly even earlier versions.
This one links to the upstream bugs at the very top and they're now closed. That's at least one signal to the reader that the post may not be up-to-date.
And although it contains some outdated information, the patterns are still useful to those using older versions of Go, and to be clear, the patterns will still work, so the information isn't all that detrimental. I think maybe there's something to be said here, but someone clicking through to here through sync.Cond is not going to be super likely to click the timers one.
Though, perhaps we could just politely ask @empijei to update the blog post once Go 1.23 is released. :)
- Go advanced concurrency patterns: part 3 (channels) explains how
TryLockandTryRLockcan be implemented, which have since become part of the standard library.
It does explain how TryLock and TryRLock can be implemented, but my impression from that page is it's much more about the expressive power of channels as an abstraction, as opposed to how to implement a missing standard library feature. This is referenced all over the blog post, but at the very top we see "The examples will correctly express the primitives but might not be as fast as the real ones." (Emphasis mine.) I think the author is clearly implying that these features may or may not already exist.
Hi there,
I updated the blogposts with a note explaining that they are there mostly for historical reasons. I don't like the idea of updating them to the latest versions as they also serve as reminders of what we used to have, and I don't want my posts to accumulate technical debt over time.
If I ever come around to write a new version of those topics I'll make sure to link to it in the old ones' headers.
I already plan to talk a bit about some more concurrency patterns that would use Go 1.24, so it's going to probably not confuse the readers.
Thanks for bringing this to my attention.
Thanks!