Hi,

Larry Wall wrote:
> On Sun, Nov 06, 2005 at 03:10:40PM +0100, Ingo Blechschmidt wrote:
[ => should not automatically bind its .value to the RHS ]

> I think binding directly to .key or .value is different from what =>
> does.  So after
> 
>     $pair = $key => $value;
> 
> setting $value doesn't change $value, but after
> 
>     $pair.value := $value
> 
> it does.

Yep, of course.

> We could have an => equivalent that does binding rather than
> copying:
[ :=>, :>, ::>, etc. ]

Personally, I think that these operators are not needed. In my PIL to
JavaScript compiler, I used the equivalent of =:> exactly two times,
and I did not mind declaring &infix:«=:>» myself, as it's such a short
and very readable declaration:

    my sub infix:«=:>» ($key, $value is rw) {
        my $pair = ($key => $value);
        $pair.value := $value;
        $pair;
    }

> our pairs are containers, not values.  Maybe \(key => $value) is
> how you turn => into ::>, since in the case of an arglist you have
> to be able to bind to the original $value.

Makes sense. :)


--Ingo

Reply via email to