Since most variable re-declaration is to support error variables, one 
likely outcome of the new error handling scheme is to end the need for it.

v1, err := f1() // this
v2, err := f2()

v1 := check f1() // becomes this (proposed by Go team)
v2 := check f2()

v1, ?err := f1() // or this (invokes a named error handler)
v2, ?err := f2()

go vet could then flag shadowing situations.

More on the feedback wiki:
https://github.com/golang/go/wiki/Go2ErrorHandlingFeedback


On Sunday, October 28, 2018 at 3:24:48 AM UTC-7, Sokolov Yura wrote:
>
> First, I know this will not happen. It is just a dream.
> Second, I'm not original: https://github.com/golang/go/issues/377 , 
> https://groups.google.com/forum/#!topic/golang-dev/wg5K15tEJRQ
> And this topic is just a forum for ideas.
>
> I'm not really against := operator, but I'm against inconsistency bound 
> with variable shadowing.
> It is really annoying to search bugs introduced with variable shadowing, 
> and since Golang presents itself as
> a language where bugs are harder to introduce, this looks to be an issue.
>
> Could Go2 be less error prone at least in this place?
>
>
>

-- 
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+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to