News for hackers. Stuff that matters.
Re:Popular Myths about C++, Part 1 by jerf on Tuesday December 09, 2014 @11:01AM (#8723458)
"Go does a good job of rectifying this: strings are generally opaque binary objects--indexing into them gives you abstract "runes" (representing Unicode code points) which can then be encoded into various flavors of UTF characters."

Overselling Go a bit there. Indexing into a string gives you that byte: http://play.golang.org/p/rxeexRzW7e

There are ways of iterating along a string by "rune" but it's not the default. That said, given that strings in Go are assumed to be UTF-8, indexing into them by rune is expensive and if you actually want to iterate by Unicode char I'm not bothered by having to be a bit more explicit about it.

Re:Popular Myths about C++, Part 1 by bkeroack on Tuesday December 09, 2014 @11:37AM (#8723702)
Strictly speaking, indexing into a string gives you an integer type (as your example also shows): https://play.golang.org/p/i7_MKja_mQ

"Rune" is an alias for int32. So we are saying the same thing, essentially.

Re:Popular Myths about C++, Part 1 by jerf on Tuesday December 09, 2014 @11:58AM (#8723875)
Try that with something that isn't one byte in UTF-8. It won't work. We aren't saying the same thing.
Re:Popular Myths about C++, Part 1 by bkeroack on Tuesday December 09, 2014 @12:40PM (#8724200)
OK. https://play.golang.org/p/Q94GFI02ru

I'm not sure what your point is in this argument? You're saying the above is worse than braindead C ASCII-only strings?

Re:Popular Myths about C++, Part 1 by jerf on Tuesday December 09, 2014 @01:33PM (#8724642)
That promising that "Go strings allow you to index into them to retrieve runes" is overselling Go's string support, of course. That's why I led with that statement, since it is what I was trying to say.

It's best to be correct about how languages work, because when you interest someone in a language via a false statement, they do not end up thinking highly of either you or the language when they discover the falsity. While I'm not sure I'd call myself a Go "advocate", I do prefer that people like and/or dislike it for valid reasons rather than invalid ones.