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

> I don't quite understand the second one (is 'boxing' supposed to be 'unboxing'?)

Yep, fixed, sorry about that.

> I think it would be weird if an unboxed union of A and B was initialized to a value that wasn't the default value of either A or B

On the one hand yes, on the other hand it would be consistent with the langage semantics (the default value of an interface type is a nil), and I don’t think defaulting to the default value of an arbitrary variant is better.

Although I can see the similarity with iota / newtype constants, the first item being the default, and similarly people could set the first type as relevantly named (possibly unexported) empty struct if they want / need the signal.



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

Search: