[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pop-dev] Go - a new language from Google

2009/11/12 Jim Whitehead II <jnwhiteh@xxxxxxxxx>
Â* There is no way to do vararg functions that I've found, so having
a "dispatch" wrapper that does just this is not easy to write.

Doesn't ... do varargs?

One thing I've noticed and I don't like: Go doesn't do UTF-8 strings very cleanly. Instead, the programmer is exposed to the UTF-8 encoding via an array of bytes (uint8s). So getting a single character from a string actually returns one byte, which may be one of a sequence of bytes encoding the character. Likewise, constructing a string from 32-bit integers (which have plenty of bits to hold a code point) seems to work by treating the 32 bits as up to four bytes in UTF-8 encoding.


Iterating with "range" over a string means iterating over the bytes and code points combined (via a function that returns both); this is not so bad but seems unnecessarily complex.

The risk of causing or encountering inexpressible byte sequences is worrying. Surely it would be better for the string implementation to hide the grungy UTF-8 encoding details and treat conversion to/from characters just as Unicode code points expressed as integers.