3 ms·
> it would be nice to retroactively define that string is a named type (or type alias) for immutable []byte Perhaps an array is better than a slice, so `immuta
by vorg 10y ago
> it would be nice to retroactively define that string is a named type (or type alias) for immutable []byte
Perhaps an array is better than a slice, so `immutable [...]byte` Also, the for-range loop would have to behave differently so I guess it's a version 2 change. And if semantics are changing anyway, I'd prefer a `mutable` keyword to an `immutable` one.
- tomjakubowski 10y ago> Perhaps an array is better than a slice, so `immutable [...]byte` Slice is the right choice, I think. Were they to choose array as the alias, the language would need to "bubble up" the "array length" type parameter to the string type, which would make strings of different byte lengths incompatible types. But hey, Go is already pretty clearly inspired by Pascal, so maybe we'll see that after all :-)