Re: Definable operators (Herman Rubin)
30 Apr 1997 21:00:10 -0400

          From comp.compilers

Related articles
[21 earlier articles]
Re: Definable operators (Craig Burley) (1997-04-18)
Re: Definable operators (1997-04-20)
Re: Definable operators (1997-04-20)
Re: Definable operators (David Rush) (1997-04-20)
Re: Definable operators (Craig Burley) (1997-04-22)
Re: Definable operators (Craig Burley) (1997-04-30)
Re: Definable operators (1997-04-30)
Re: Definable operators (1997-05-04)
Re: Definable operators (Dave Lloyd) (1997-05-04)
Re: Definable operators ephram@ear.Psych.Berkeley.EDU (Ephram Cohen) (1997-05-06)
Re: Definable operators (Francois-Rene Rideau) (1997-05-08)
Re: Definable operators monnier+/news/comp/ (Stefan Monnier) (1997-05-08)
Re: Definable operators (Craig Burley) (1997-05-08)
[10 later articles]
| List of all articles for this month |

From: (Herman Rubin)
Newsgroups: comp.compilers,comp.lang.misc
Date: 30 Apr 1997 21:00:10 -0400
Organization: Purdue University Statistics Department
References: 97-03-037 97-04-113 97-04-130 97-04-164
Keywords: syntax, design, comment

> (Antoon Pardon) writes:
>> But faulting the language because it allows "+" to be used
>> inappropiately while we don't seem to have problems with languages
>> that allow "insert" to be used inappropiately doesn't make sense to me.


Craig Burley <> wrote:
>A language that allows no overloading of + at all, defines it to mean
>only addition, and that its operands are only evaluated once, has
>certain linguistic advantages, but less flexibility. (FORTRAN 77 and
>C are basically like this.)

>A language that encourages arbitrary overloading of + to whatever
>people want to do with it, _including_ modifying the operators, not
>performing a commutative operation, whatever, has much greater
>flexibility, but compares poorly in _this_ respect to the former
>example. (C++ is basically like this.)

There are languages like C++ which allow arbitrary overloading of
existing operators, but I agree with you that this can easily be
too much. Making the same operator mean totally different things
can certainly be bad.

But it also does not provide enough. I criticize the lexically
simple languages for not allowing the user to add additional
operators, with the user's syntax, and with the possibility of
having the compiler use information, not just about the types of
the arguments, but also about their values, to achieve better
performance. I have seen the symbol "^" (or this symbol rounded)
used for string concatenation before some language designers
grabbed it for XOR. It has also long been used for the power
operator in mathematics, which is different in many respects
from the power function.
Herman Rubin, Dept. of Statistics, Purdue Univ., West Lafayette IN47907-1399 Phone: (765)494-6054 FAX: (765)494-0558
[As always, I encourage Herman to sketch out an example of how such a
language would look and work. -John]

Post a followup to this message

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