Proposal: Sameness operators

Tom Hawtin Thomas.Hawtin at Sun.COM
Thu Apr 2 05:29:17 PDT 2009

Reinier Zwitserloot wrote:
> Why can't we use compareTo and equals?

  * compareTo may well be unreasonably inefficient.
  * equals handles nulls (asymmetrically), compareTo does not
  * equals does test-and-cast (event for generic types - urgh), 
compareTo uses generics
  * equals does not throw ClassCastException, compareTo does (but 
probably shouldn't with generics)

Therefore, new methods please. I'm sure you are aware the whole subject 
of operator overloading in general is a minefield.

> .<. syntax had severe problems that disqualified them - see the  
> archive of this mailing list.

Other than reminding me of the F-language, as a lexical token it is 
perfectly upstanding. The IDE behaviour is a bonus (well I find menus 
popping up as I type almost as annoying as Flash adverts and b***king 
cursors, but you get what I mean).

> The cleanest solution to me remains a cleaning of the slate, so to  

Making a slight change wouldn't be an effective cleaning of the slate, 
IMO. Lots of downsides (not necessarily to you in particular) and not 
enough upsides.

Anyway, I think we all knew which way the wind was blowing on proposals 
like this one from the start of the process.

Tom Hawtin

More information about the coin-dev mailing list