Definable operators 
Author Message
 Definable operators


>> 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.


>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

[As always, I encourage Herman to sketch out an example of how such a
language would look and work. -John]

Sun, 17 Oct 1999 03:00:00 GMT  
 [ 1 post ] 

 Relevant Pages 

1. operator overloading and user definable operators.

2. Definable operators

3. Definable operators (was: Problems with Hardware, Languages, and Compilers)

4. User definable operators

5. User Definable Runtime Report Formater/Wizard-CPD2x

6. User definable field name?

7. user definable browse box

8. User Definable Reports

9. Adding a User Definable Logo to an app

10. Overloading logical operators and bitwise operators

11. OPERATOR (was: Why no ** operator in Modula2?)

12. Aliases for operators, creating new operators


Powered by phpBB® Forum Software