Operator Overloading and Meta-Operators

crowl@jade.cs.orst.edu (Lawrence Crowl)
Tue, 22 Sep 1992 00:14:50 GMT

          From comp.compilers

Related articles
language design tradeoffs kotula@milli.cs.umn.edu (1992-09-07)
Re: language design tradeoffs bks@s27w007.pswfs.gov (1992-09-17)
Operator Overloading and Meta-Operators crowl@jade.cs.orst.edu (1992-09-22)
| List of all articles for this month |

Newsgroups: comp.compilers,comp.human-factors
From: crowl@jade.cs.orst.edu (Lawrence Crowl)
Organization: Oregon State University, Corvallis Oregon
Date: Tue, 22 Sep 1992 00:14:50 GMT
References: 92-09-048 92-09-110
Keywords: parse, design

bks@s27w007.pswfs.gov (Bradley K. Sherman) writes:
> 3) No macros or overloading. Sorry, but x + y means add y to x.
                I do not want it to mean place object y on window x.


Which add where you refering to? Fixed-length integer add,
variable-length integer add, fixed point add, floating point add, double
precision floating point add, complex add, rational add, interval add,
boolean add, vector of floats add, matrix of floats add, or something
else?


I don't think we can avoid overloading, especially given the increased
number of "primitive" numeric types. What we probably can do is ask that
such operators all obey a reasonable set of arithmetic properties, e.g.
commutivity and associativity.


Mathematics has many such "meta-operators", and the use of "+" to signify
"the appropriate one" doesn't appear to be too much of a problem.
Programming languages have a more difficult task, but still it would be
useful if the programming community had more widely recognized
meta-operations like "put this item into that data structure", so that
programmers can use operators for common operations and still not suprise
other programmers by their choice of operator.


--
    Lawrence Crowl 503-737-2554 Computer Science Department
crowl@cs.orst.edu Oregon State University
...!hplabs!hp-pcd!orstcs!crowl Corvallis, Oregon, 97331-3202
--


Post a followup to this message

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