(no title)
fizzbatter | 9 years ago
Granted, i left out nil pointer/interface panics because it seems unrealistic given how difficult it was for Rust to get rid of nil pointers. I'm not sure Go 2.0 could do it and still be considered Go.
fizzbatter | 9 years ago
Granted, i left out nil pointer/interface panics because it seems unrealistic given how difficult it was for Rust to get rid of nil pointers. I'm not sure Go 2.0 could do it and still be considered Go.
masklinn|9 years ago
That wasn't really a difficult part, it's just a basic application of generic enums.
Now Go doesn't have (userland) generics or enums, but they could have taken the same path as other languages (and the one Go is wont to take): special-case it. Which they probably can't anymore because of zero-valuing, you can't have a zero value for non-null pointers.
jerf|9 years ago
I still faintly hold out hope. Unlike many of the complaints about Go that would require fundamental restructuring, C# showed that actually can be retrofitted onto a language without breaking it.
pcwalton|9 years ago
C# added nullable types. Not non-nullable types.
In Go, the concept of zero values is so fundamentally baked into the semantics that non-nil pointers can never really be added to it.
stcredzero|9 years ago
pcwalton|9 years ago
That wasn't difficult at all.