Does ‘state’ govern ‘:=’ the way it governs ‘=’?  In other words, just as this:

    state $x = 1;

only assigns to $x once (per closure), does the same apply to this?

    state $x := $y;

I can’t find anything in the specs that implies that it does.

The reason I ask is that I am currently implementing binding for Perl 5, but 
the syntax is different—

    \$x = \$y;

(The reason for the different syntax is that, when we tried to use :=, we could 
not find a coherent way to handle edge cases [e.g., flattening vs not 
flattening].  Reusing existing Perl 5 syntax seemed the most straightforward 
and intuitive approach.)

—and I am debating whether \state $x = \$y should bind only once or every time 
the surrounding code is executed.  I could argue it either way (though I am 
leaning toward the latter), so I thought to find out what Perl 6 does.

Reply via email to