[1043] in java-interest

home help back first fref pref prev next nref lref last post

Re: Operator underloading (was: overloading of operators)

daemon@ATHENA.MIT.EDU (Scott Treacy)
Thu Aug 17 14:11:58 1995

Date: Thu, 17 Aug 1995 15:47:43 +0000
To: java-interest@java.sun.com
From: S.P.Treacy@scotborders.co.uk (Scott Treacy)

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

>Philip    
>
>
>---
>Philip Gladstone
>Onsett International Corporation, Cambridge, MA
>
>
>-
>Note to Sun employees: this is an EXTERNAL mailing list!
>Info: send 'help' to java-interest-request@java.sun.com
>
>

*   Scott P. Treacy   *  Email: S.P.Treacy@elgeebar.scotborders.co.uk   *
*    aka Elgeebar     *  Phone: +44 1896 870490  Fax: +44 1896 757965   *
*  Smail: 17 Park Avenue, Walkerburn, Borders, Scotland, UK. EH43 4AN.  *

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post