Yes, that works nicely, thanks. But sometimes (rarely) you do want a contiguous bunch of objects, rather than have the indirection.
I think ideally, it would work (as an alias) but if not, I think it should error. Or maybe this is a FAQ, with a good rationale, which I just haven't got to yet.
Re:Things I Love About Go
by drivebyacct2 on Friday June 22, 2012 @07:39PM
(#4149472)
I've been burnt by it as well, I didn't read the spec closely enough apparently. I would love to see it called out in an example.
Btw code that uses range will always be faster than alternative with for loop and indexing (obj[i]) as range-based code can be optimized by Go compiler not to perform any bound checks.