[1074] in java-interest
Re: Operator underloading (was: overloading of operators)
daemon@ATHENA.MIT.EDU (George Reynolds)
Fri Aug 18 00:42:17 1995
Date: Thu, 17 Aug 1995 13:27:23 -0400
From: George Reynolds <george@dvcorp.com>
To: java-interest@java.sun.com
>> >Walter Smith wrote:
>> >
>> >>Another issue: If it looks small, it looks cheap. That + sign may be
>> >>costing unbounded amounts of space and time, but most people are trained to
>> >>think it's a one-cycle integer add. Sure, if you ask them, they may know
>> >>what it is, but when they're quickly scanning the code, they pass right
>> >>over it.
>> >
>> >I propose that we do some operator-underloading. The + sign is already used
>> >for integers and floating point. This leads to endless confusion, so I
>> >propose that + is reserved only for integers, and that a new operator
>> >("floatAdd" - if you like smalltalk syntax) or a class member function be
>> >defined to add floats.
>> >
>> >This approach has some useful advantages - the comparison operator <
>> >would be replaced by "floatLessThan", and we could eliminate the
>> >floating point <= operator entirely (as floating point numbers are
>> >very rarely equal to other floating point numbers).
>> >
>> >The readability of the language would improve - you wouldn't have to
>> >worry about whether 10/4 is actually 2 or 2.5
>> >
>> >Any more votes for operator underloading? :-)
>>
>> Sound like quite a good idea to me....
I agree!! Lets do it! Any more votes?
George
-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com