Hacker News new | ask | show | jobs
by ayuhito 473 days ago
Go recently did add a new weak pointers and string interning package to its standard library which is an interesting read.

[0] https://go.dev/blog/unique

1 comments

> string interning package to its standard library

TFA literally says interning isn't there in Go yet.

  While the unique package is useful, Make is admittedly not quite like Intern for strings, since the Handle[T] is required to keep a string from being deleted from the internal map. This means you need to modify your code to retain handles as well as strings.
> an interesting read

Tailscale's attempt at implementing "unique" was quite... something: https://tailscale.com/blog/netaddr-new-ip-type-for-go

The Tailscale article taught me a lot! Thanks for sharing.