On Thu, Jun 24, 2004 at 12:34:44PM +0200, Michele Dondi wrote:
: I don't know if this is already provided by current specifications, but
: since I know of Perl6 that is will support quite a powerful system of
: function prototyping ("signatures"?), I wonder wether it will be possible
: to specify a (finite number of) argument(s) on the left of functions, thus
: allowing to create user-defined operators. I had tried sml (a functional 
: language) and despite its being really simple if compared to Perl, it 
: provided this functionality...

Yes, this is already provided for with infix/postfix operators/macros,
with the caveat that if you wish to specify multiple arguments to the
left, you'll have to do one of:

    1) give your operator a looser precedence than comma
    2) group the arguments with some kind of brackets or parens to
       make them a single argument
    3) put some kind of introductory macro out front that parses
       things the way you want
    4) write the definition of your infix/postfix macro to have
       incestuous knowledge of the parser in order to slurp the
       leftwise arguments that have already been reduced by the
       ordinary grammar.  Simple.  :-)

Actually, I suspect that infix macros have precedence much like operators,
so #4 probably reduces to #1.  (Macros differ from ordinary operators in
how they treat the subsequent text, not the preceding text.)

Larry

Reply via email to