----- Original Message -----
From: David Storrs <[EMAIL PROTECTED]>
Date: Thursday, July 1, 2004 7:55 pm
Subject: Re: if not C<,> then what?

> On Thu, Jul 01, 2004 at 04:14:37PM -0700, Jonathan Lang wrote:
> > Juerd wrote:
> > 
> > If you're really enamoured with the infix operator syntax, 
> consider this
> > possibility: 
> > 
> >   sub infix:-> ($before, $after) {
> >     $before;       # is this line redundant?  
> >     return $after;
> >   }
> >   print $a -> $b -> $c;   # prints $c
> > 
> > where C[->] is read as "followed by".  You could even set up a
> > right-to-left version, C[<-], but why bother?  
> 
> You could do this, but you'd be overriding the current meaning of 
> C<< -> >> as "pointy sub".
> 
> You could also use, 'before':
> 
>    #  Recipe for (un)holy water that will irk the altar's god.    
>    step_on_altar();
>    drop_water($_) before pray() for @water_potions;
> 
> OOC, can you define an operator that is made up of alphanumerics, or
> only punctuation?  e.g., is this legal?
> 
> sub infix:before ( $before, $after ){ ... }
> 
> --Dks

Sure.  The parser won't care what kind of characters
make up the operator, as long as its defined by the
time the operator is encountered.  The "operator" 
rules in the grammar will probably be as simple as this:

# where x is the type of operator; infix, prefix, etc
rule x_operator:u2 {
    %*X_OPERATORS
}

- Joe

Reply via email to