News for hackers. Stuff that matters.
Re:Union types ('enum types') would be complicated in Go by skybrian on Saturday December 07, 2024 @01:27AM (#42347695)
Yes, the Go garbage collector would need to support some new memory layouts to make certain kinds of unions efficient. A union between a double, a pointer, and small integer types (as done in languages like JavaScript) might be a good start?
Re:Union types ('enum types') would be complicated in Go by tignaj on Saturday December 07, 2024 @03:04AM (#42348095)
Here is a fairly efficient version of a simple union like that I did a while back https://github.com/tigrannajaryan/govariant