3 ms·
I agree with your first paragraph. 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
by foldr 3y ago
I agree with your first paragraph.
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, although I take your point that it's a technically possible implementation.
- masklinn 3y ago> 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.