Ken Fox wrote:

 >>     / $x := (gr\w+) /    vs    / (gr\w+) { let $x = $1 } /
 >>
 >>Shouldn't they both use C< := > ?

They should. The second version is a typo. It should be:

                                    / (gr\w+) { let $x := $1 } /


 > Depends on what you want. The "$x :=" in the rule binds the
 > first match to $x -- it does not copy the value. The "$x ="
 > in the code block copies the value of the first match. You
 > can use either binding or assignment in the code block.

But not with the C<let> keyword. That requires binding.


 > Both of them will be "undone" during backtracking. It's more
 > efficient to bind, but the copy guarantees changes to $x and $1
 > are independent.

This is not what Larry has said previously. He said that only
binding can be used with C<let> variables and that only C<let>
variable assignments are undone on backtracking.

Damian



Reply via email to