Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The language and way of writing feels very weird. The concepts are simple genetics but for some reason I don’t get the idea of underlying type. Wish they used a more formal language


it's not doing anything particularly interesting from a formal perspective. If you're familiar with Haskell's newtype deriving, the tilde is solving the same problem—just at the use-sites of the type instead of at the declaration site. The types it tends to be useful for are the types that Go allows as constants (https://go.dev/ref/spec#Constants), which tend to be the type classes that modern Preludes will overload the literals for.


That’s exactly it… every time I’ve tried to find detailed docs about go generics I just find really confusing prose with examples




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: