Not that the best software is designed by consensus but I appreciate the support Mike. I like Go. Nothing is perfect. It’s amazing they were able to add generics in a backwards compatible manner. But I long for a Go 2.0 where they broke compatibility and fixed some critical errors that I suspect the core Go is well aware of. 

On Jan 15, 2026, at 9:36 PM, Mike Schinkel <[email protected]> wrote:


On Jan 14, 2026, at 11:43 AM, Robert Engels <[email protected]> wrote:
I know it won’t/can’t change - but took the opportunity to rant :)

I will second this rant.  

That behavior has resulted in more bugs — that I have personally seen — than I can count on all my digits. :-(


On Jan 15, 2026, at 6:37 PM, Mike Schilling <[email protected]> wrote:
It's handy behavior, because it let you write

  x , err := method1()
  if err !=nil {
    ...
  }
  y , err := method2()
  if err !=nil {
    ...
  }
instead of having to have multiple error variables.

Shadowed err variables is where shadowing has bitten me the worst. I recently wrote a linter to flag ALL variable shadowing, especially err.

On Jan 15, 2026, at 6:44 PM, Robert Engels <[email protected]> wrote:
No doubt, but it also increases the cognitive load at the call site - which is sort of against Go’s desire for explicitness. 

THIS.

-Mike

On Jan 15, 2026, at 6:44 PM, Robert Engels <[email protected]> wrote:

No doubt, but it also increases the cognitive load at the call site - which is sort of against Go’s desire for explicitness. 

On Jan 15, 2026, at 5:38 PM, Mike Schilling <[email protected]> wrote:

It's handy behavior, because it let you write

  x , err := method1()
  if err !=nil {
    ...
  }
  y , err := method2()
  if err !=nil {
    ...
  }
instead of having to have multiple error variables.


On Wednesday, January 14, 2026 at 9:38:39 AM UTC-8 Robert Engels wrote:
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/c8bb7987-500f-464e-9741-bc8054076d26n%40googlegroups.com.

--
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/0AFDB5C9-475C-43D9-8AC3-258619750986%40ix.netcom.com.

--
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/C1710BB5-15B4-447B-9573-B7A311E25A5E%40ix.netcom.com.

Reply via email to