develooper Front page | perl.perl6.language | Postings from April 2002

Re: Please rename 'but' to 'has'.

Thread Previous | Thread Next
From:
ggermain
Date:
April 23, 2002 10:12
Subject:
Re: Please rename 'but' to 'has'.
Message ID:
1019581926.3cc595e667780@courrier.privatedns.com
In reply to Buddha Buck <bmbuck@14850.com>:

> At 08:58 AM 04-23-2002 -0700, Larry Wall wrote:
> >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 }
> 
> OK, but that limits you to the, um, 24 standard levels of precedence. 
> What 
> do you do if you don't think that that's enough.  Let's say you want to
> 
> define a "nand" operator:
> 
> my sub operator:nand ($a, $b) is inline { not ($a and $b) }
> 
> but you want nand to have a precedence lower than the existing 'and' but
> 
> higher than the existing 'or' (for some reason I can't imagine 
> offhand).  It isn't like() anything, since there isn't anything
> currently 
> between 'and' and 'or'.  Would that be something like:
> 
> my sub operator:nand ($a, $b) is below("and") is inline {not ($a and $b)
> }
> 

24 levels of precedence should be enough, else you can always resort to parens.

Guillaume

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About