|User definable operators firstname.lastname@example.org (William Clodius) (1996-12-14)|
|Re: User definable operators email@example.com.OZ.AU (1996-12-15)|
|Re: User definable operators firstname.lastname@example.org (Charles Fiterman) (1996-12-15)|
|Re: User definable operators email@example.com (Ehud Lamm) (1996-12-15)|
|Re: User definable operators ddean@CS.Princeton.EDU (1996-12-15)|
|Re: User definable operators firstname.lastname@example.org (1996-12-15)|
|Re: User definable operators email@example.com.OZ.AU (1996-12-15)|
|Re: User definable operators firstname.lastname@example.org (Craig Burley) (1996-12-18)|
|Re: User definable operators email@example.com (1996-12-18)|
|[17 later articles]|
|From:||Charles Fiterman <firstname.lastname@example.org>|
|Date:||15 Dec 1996 16:15:39 -0500|
William Clodius <email@example.com> wrote:
>Many programming languages allow the user to overload of language
>defined operators. But a few languages also allow the user to define
>their own operators. I would like to have some feedback on the
>experience of others with user definable operators with respect to
>specifying their syntax, associativity, precedence, semantics (e.g.,
>side effects or not), etc.
First if a user overloads + - * / its important that the overloads
act like the original arithmetic operators. So using them for your
new multi precision numbers or rationals is good using them for
string operations is evil. Ideally the optimizer should be able
to say (a + b - b) is the same as (a). Further a += b is the same
as a = a + b except that a is only evaluated once. This reduces
the number of basic things that need to be defined.
Further, it's important to allow new operators. There are dot products
and cross products and we need symbols for both. Having something like
unicode as the symbolic base is ideal because computer math can look
like published math. Very brilliant people have worked on mathematical
symbolism for centuries and produced a highly readable
result. Throwing it away on abominations like sqrt for the radical
sign is pure evil.
And symbols need to be of variable size as in Tex. And we need symbols
for things like for loops and if statements which include the things
they operate on much like large sigma symbols and integral signs.
In math its name and conquer so people need to build their own symbols
easily and use them easily.
Return to the
Search the comp.compilers archives again.