Aaron Sherman writes:
: On Mon, 2002-04-22 at 19:22, Larry Wall wrote:
: 
: > Perl 6 will try to avoid synonyms but make it easy to declare them.  At
: > worst it would be something like:
: > 
: >     my sub operator:now ($a,$b) is inline { $a but $b }
: 
: I see your point, and it makes sense, but how will precedence work? What
: would this do:
: 
:       $i now foo but bar and 2;
: 
: or this:
: 
:       $i but foo now bar and 2;
: 
: What if I want to define a synonym for and?
: 
:     sub operator:also ($a,$b) is inline { $a and $b }
:     print $_ also die;
: 
: Scratching my head here in userville....

Precedence is set with the "like' property:

    my sub operator:now ($a,$b) is like("but") is inline { $a but $b }
    sub operator:also ($a,$b) is like("and") is inline { $a and $b }

Larry

Reply via email to