After several months of fairly intensive toying with go, I've
identified something that I'm not convinced is an actual issue, and
wanted to ask others what they thought.
The gist of the issue is that inner loop (for) blocks behave
differently than one might expect w/r/t ':=' and the rest of the go
language in my experience.
Attached )sorry) is an example of 3 common implementations of a
trivial function using a (contrived, trivial) double-return function,
and a (commented out) "idealized" syntax.
Since what's happening is actually understandable, it doesn't seem to
be a bug; That said, it's not an easy-to-spot difference between
variances without a keen eye.
Any thoughts/opinions?
Cheers,
James
Rather than rehash that recent thread, I'll simply vote +1 for :=
'remasking' behavior to be consistent between for-loops and 'normal'
scope (completely ignoring inner functions and their concerns with
this vote). Of course, this isn't a democracy, so it's more a request
for touch-up paint on the shed I guess.
Thank you!
James
And if you're *seriously* interested:
http://groups.google.com/group/golang-nuts/browse_thread/thread/5f070b3c5f60dbc1
http://groups.google.com/group/golang-nuts/browse_thread/thread/defbff7e6a81c085
http://groups.google.com/group/golang-nuts/browse_thread/thread/fa0e6d0438bf165e
http://groups.google.com/group/golang-nuts/browse_thread/thread/585ec372c24c83bb
http://groups.google.com/group/golang-nuts/browse_thread/thread/22d61234aaadfe40
http://groups.google.com/group/golang-dev/browse_thread/thread/37e72d4d4fc5a356
http://code.google.com/p/go/issues/detail?id=377
http://code.google.com/p/go/issues/detail?id=514
http://code.google.com/p/go/issues/detail?id=469
http://code.google.com/p/go/issues/detail?id=739
--
Gustavo Niemeyer
http://niemeyer.net
http://niemeyer.net/blog
http://niemeyer.net/twitter