Nicholas (>):
> Where in the synopses (or other documents) does it explain why these two
> are different?
>
> $ ./perl6 -e 'sub foo {state @a = (3, 4); say ++@a[0];}; foo; foo;'
> 4
> 5
> $ ./perl6 -e 'sub foo {(state @a) = (3, 4); say ++@a[0];}; foo; foo;'
> 4
> 4

S03:4912. "Each declarator can take an initializer following an equals
sign (which should not be confused with a normal assignment, because
the timing of the initialization depends on the natural lifetime of
the container, which in turn depends on which declarator you use)."

In other words, the parens turn the special equals sign into normal
assignment again.

// Carl

Reply via email to