2012/9/29 Dumitru Ungureanu <
itmi...@gmail.com>:
> Thanks Jan.
>
> My mistake. I was doing:
>
> err,a := x()
> err,a := y()
>
> not
>
> err,a := x()
> err,b := y()
>
>
> To conclude:
>
> - using the short declare syntax (:=) to redeclare a variable in two or more
> places on the same context level will change the reference completely to the
> variable in the last := for that context
No. If you type
a, err := blah()
b, err := bloh()
The err is the same in both clauses.
In the spec: "Unlike regular variable declarations, a short variable
declaration may redeclare variables provided they were originally
declared in the same block with the same type, and at least one of the
non-blank variables is new. As a consequence, redeclaration can only
appear in a multi-variable short declaration. Redeclaration does not
introduce a new variable; it just assigns a new value to the
original."
Rémy.