Buddha Buck writes:
: 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) }

Yes, that's what I was thinking.  And the dimensions shrink every time
you do that, so if something is "above" your C<nand>, it doesn't go
back to being the same as C<and>.

Though since people can't seem to keep up and down straight on their
precedence charts, I'd go for "tighter" and "looser" or some such.  I
think I'm even on the record somewhere about that.

Larry

Reply via email to