Draft proposal: allow the use of relational operators on Comparable classes
rssh at gradsoft.com.ua
rssh at gradsoft.com.ua
Tue Mar 10 16:57:53 PDT 2009
> In languages with both == and ===, the == is more like .equals(), and
> the === is more like java's ==. Making them the reverse in java is a
> really really bad idea. I'd far rather have a way to specify that
> you're on 'new mode' java, and have == imply equals, and remove object
> identity altogether; it's just not a relevant operation. Shove it off
> to a java.lang library call. That's what we did with System.arrayCopy
> too, and that was clearly a good idea.
>
This will break a lot of code. Better find better symbol :)
> --Reinier Zwitserloot
> Like it? Tip it!
> http://tipit.to
>
>
>
> On Mar 11, 2009, at 00:51, rssh at gradsoft.com.ua wrote:
>
>>
>> IMHO, would have sense with addition of symbol for equality check:
>> ('==='
>> ?)
>>
>>
>>> I've attached a draft of a proposal to allow classes which
>>> implement the
>>> Comparable interface to be used as operands for the relational
>>> operators.
>>> So
>>> for example if you had two Strings, a and b, you would be able to
>>> write
>>>
>>> if (a < b) {
>>> ...
>>> }
>>>
>>> instead of
>>>
>>> if (a.compareTo(b) < 0) {
>>> ...
>>> }
>>>
>>> and you could do the same with your own classes as well.
>>>
>>> Thanks in advance for any feedback,
>>>
>>> Vil.
>>>
>>>
>>
>>
>>
>
>
>
More information about the coin-dev
mailing list