go icon indicating copy to clipboard operation
go copied to clipboard

sync: outdated referenced documentation in `Cond`

Open gazerro opened this issue 1 year ago • 1 comments

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:

gazerro avatar Jun 29 '24 15:06 gazerro

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.

MikeMitchellWebDev avatar Jun 29 '24 17:06 MikeMitchellWebDev

@golang/runtime per owners -- any opinions on this issue?

thanm avatar Jul 03 '24 20:07 thanm

I looked over the two links your pointed out, and I think it's OK to leave it as-is.

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. :)

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.

mknyszek avatar Jul 08 '24 19:07 mknyszek

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.

empijei avatar Dec 17 '24 12:12 empijei

Thanks!

ianlancetaylor avatar Dec 17 '24 18:12 ianlancetaylor