On 01/09/2018 04:45 PM, Ian Lance Taylor wrote:
> On Tue, Jan 9, 2018 at 1:02 PM, Jim Bishopp
> <james.bish...@gmail.com> wrote:
>> 
>> Has there ever been a discussion about allowing new identifiers and
>> selectors in short variable declarations?
>> 
>> var a struct { x int } b, a.x := 1, 2
>> 
>> ERROR: expected identifier on left side of :=
> 
> That idea appears in https://golang.org/issue/377, along with many 
> others.
> 

I had the same question myself. I settled on the idea that that is a
short declaration -- not an assignment -- though it does re-declare
existing variables (of the same type!). That behaves like assignment
but I think it is still declaration.

But its behavior makes sense if you consider that you can't declare or
re-declare struct member.

-ayan

-- 
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