On 5/6/05, Stuart Cook <[EMAIL PROTECTED]> wrote:
> (snip) As long as each meta-operator
> explicitly knows what type of regular operator it accepts (and
> produces), there shouldn't be any problems with ambiguity.
> 

Having posted that, I immediately thought of some problems:

If a meta-operator has
{meta-fixity => prefix|circumfix, result-fixity => prefix}
then it can be confused with a term, e.g.:

$x = [+1, -2, +3]; # opening [ indicates a term
$y = [+] @stuff; # opening [ indicates a meta-op producing a prefix operator

This might confuse the parser, though I suppose you could always try
both possibilities and see which one works.

The second problem is if a meta-operator has
{meta-fixity => postfix, argument-fixity => x, result-fixity => y}
where (x != y).

# Imagine '◎' is a meta-postfix taking an infix and and returning a 
prefix.
# The parser will reject ¥, because it doesn't know to expect
# an infix op until it reaches the ◎.
@x = ¥◎ @z;
# The parser might assume that + is prefix (since a term is expected),
# then have to go back and treat it as an infix instead.
$x = +◎ $z;

This will /really/ confuse the parser, and should probably (IMO) be outlawed.


Stuart

Reply via email to