Re: User definable operators

Nick Kramer <nkramer@cs.cmu.edu>
20 Dec 1996 17:18:45 -0500

          From comp.compilers

Related articles
[5 earlier articles]
Re: User definable operators dennis@netcom.com (1996-12-15)
Re: User definable operators fjh@mundook.cs.mu.OZ.AU (1996-12-15)
Re: User definable operators burley@gnu.ai.mit.edu (Craig Burley) (1996-12-18)
Re: User definable operators jdean@puma.pa.dec.com (1996-12-18)
Re: User definable operators neitzel@gaertner.de (1996-12-18)
Re: User definable operators tim@franck.Princeton.EDU (1996-12-20)
Re: User definable operators nkramer@cs.cmu.edu (Nick Kramer) (1996-12-20)
Re: User definable operators hrubin@stat.purdue.edu (1996-12-24)
Re: User definable operators preston@tera.com (1996-12-26)
Re: User definable operators burley@gnu.ai.mit.edu (Craig Burley) (1996-12-26)
Re: User definable operators mfinney@inmind.com (1996-12-26)
Re: User definable operators leichter@smarts.com (Jerry Leichter) (1996-12-27)
Re: User definable operators genew@mindlink.bc.ca (1996-12-28)
[8 later articles]
| List of all articles for this month |

From: Nick Kramer <nkramer@cs.cmu.edu>
Newsgroups: comp.compilers
Date: 20 Dec 1996 17:18:45 -0500
Organization: School of Computer Science, Carnegie Mellon
References: 96-12-088 96-12-127
Keywords: design

Jeff Dean <jdean@puma.pa.dec.com> wrote:
>Cecil also allows operators to consist of normal alphanumeric symbols,
>if they are preceeded by an '_' character. This also aids in the
>defining of understandable infix operators. For example:
>
> precedence _is_stronger_than non_associative below _or above =;
>
> method is_stronger_than(l@cse_information, r@cse_information):bool {... }
>
> if(A _is_stronger_than B, { ... });


The Dylan group briefly considered the idea of allowing *all* binary
functions to be used in an infix manner, without declaring anything
before hand. So "x equals y" would be equivalent to "equals(x, y)",
and the two forms could be used interchangably. What you couldn't do
is have the binary function itself be an expression: "x
make-function() y" was not valid. If you allow arbitrary expressions
to compute the binary function, you open the door to constructs like
"x (equals) (y)" -- is "(equals)" a parameter list, or is it an
expression with optional parenthesis around it?


The proposal had only one level of precedence for infix functions,
although I forget if there was a separate concept of operators (things
like + and * might have been considered binary functions with unusual
names). The proposal was rejected for a variety of reasons, including
uncertainties about how it would interact with the then-unfinished
macro system.
--


-Nick Kramer
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.