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

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



On Thu, Nov 12, 2009 at 5:10 PM, Rick Beton <rick.beton@xxxxxxxxx> wrote:
> 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?
> http://golang.org/doc/go_spec.html#Passing_arguments_to_..._parameters

See, we're all still learning =)  Thanks for the heads up, I'll take a
look at a more succinct solution.

> 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.
>
> Yuk.
>
> 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.

Yeah the UTF8 handling is a bit weird, I must say.

- Jim