Remix.run Logo
CamouflagedKiwi 4 hours ago

This feels like it should ideally be something public in the structs package so anyone can leverage it, not just a specially blessed internal thing for the sync package.

advisedwang 31 minutes ago | parent | next [-]

It's not a specially blessed type. As the article says, anything that implements sync.Locker acts like this.

0x696C6961 3 hours ago | parent | prev | next [-]

https://github.com/golang/go/issues/70811 Go moves slowly

ape4 3 hours ago | parent | prev | next [-]

I agree, its a nice piece of semantics to be added to a struct

wbl 3 hours ago | parent | prev [-]

You can very easily define one yourself.

kbolino 3 hours ago | parent [-]

You can exploit the mechanism described in the article yourself, but it's already changed once in the past and is not part of any compatibility guarantee. As with structs.HostLayout, a blessed structs.NoCopy in the standard library could guarantee that it works forever. I think the bigger issue remains that it doesn't actually do anything in the language (but, then again, neither does structs.HostLayout--yet).