You're not actually shadowing a variable in either of those cases. It
cannot lead to confusion (even if the variable is re-used under the hood.)
"x := foo()" from the previous iteration of the loop will not be in scope,
nor would you have access to an argument named "b" from a previous call to
a recursive function.


On Thu, Feb 21, 2013 at 9:18 PM, Jan Mercl wrote:

On Feb 21, 2013 8:52 PM, "Thomas Bushnell, BSG" wrote:

That's not actually true, because presumably the shadowing opponents
still want recursion to work.

Oh, you're right of course, I forgot to consider recursive calls. Even
worse, I failed to consider a variable declared inside a loop too.

You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

Discussion Posts


Follow ups

Related Discussions



site design / logo © 2021 Grokbase