4 ms·
Strictly speaking, indexing into a string gives you an integer type (as your example also shows): https://play.golang.org/p/i7_MKja_mQ https://play.golang.org/p
by bkeroack 12y ago
Strictly speaking, indexing into a string gives you an integer type (as your example also shows): https://play.golang.org/p/i7_MKja_mQ https://play.golang.org/p/i7_MKja_mQ
"Rune" is an alias for int32. So we are saying the same thing, essentially.
- jerf 12y agoTry that with something that isn't one byte in UTF-8. It won't work. We aren't saying the same thing.
- bkeroack 12y agoOK. https://play.golang.org/p/Q94GFI02ru 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?
- jerf 12y agoThat 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.