News for hackers. Stuff that matters.
Re:Go 1.18 by earthboundkid on Tuesday March 15, 2022 @02:00PM (#30688650)
Yes, the only downside I see is that if you do:

    type Number interface { int | int64 | int32 }
    var n Number
The default value for n has to be nil, rather than 0, because Go can't choose between the types (int 0, int64 0, etc.). And of course, you can't do n + x (assuming x is also a Number) because x might be a different kind of number. Still, it's a pretty good simplification from the current restrictions, and it builds well on existing concepts.

There are no comments on this comment yet.