Yes, I was using shadowing loosely. 

When you have

var x int
… 100 lines of code …
x,y := somefunc()

And y is a new variable - you have no idea at the call site which is a new 
variable and which is not. 

That is the “shadowing” I’m referring to - loosely in that it obscures what is 
actually happening at the call site. You need to know other context - breaking 
Go’s desire for explicitness. 

> On Jan 14, 2026, at 11:23 AM, Jan Mercl <[email protected]> wrote:
> 
> On Wed, Jan 14, 2026 at 6:09 PM Robert Engels <[email protected]> wrote:
> 
>> Yes it does. You can declare new variables while assigning to old in Go.
> 
> No it does not AFAICT. You wrote:
> 
> """"
> ... mixing of new and old declarations with new variables possibly
> being introduced or old ones shadowed.
> """"
> 
> Please show a playground program where this happens. Note: shadowing
> can happen only across blocks. The rules for short variable
> declarations apply only within one block.
> 
> Caveat emptor: Go specs do not define the term "shadowing". So you may
> be using a very different definition of shadowing than most other
> people have in mind when talking about shadowing variables in Go.

-- 
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 [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/C1BEB1B1-DB4E-4F44-903C-76A7D2C25CA8%40ix.netcom.com.

Reply via email to