3 ms·
Go's standard library works with both possibly-malformed and verified UTF-8 strings, which is a nice property. The type system needed to explain what they actu
by skybrian 6y ago
Go's standard library works with both possibly-malformed and verified UTF-8 strings, which is a nice property.
The type system needed to explain what they actually do (take one of two possible input types and return the corresponding output type) would require generics, which we don't have yet.
An alternative would be to duplicate the code to account for the different types, but we already have that for []byte versus string and that's bad enough already.