Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

osfameron (3135)

  (email not shown publicly)

Technorati Profile []

Journal of osfameron (3135)

Tuesday May 03, 2005
04:41 AM

Java and operator overloading.

[ #24501 ]
It bemuses me that Java guru Joshua Bloch is still anti operator overloading ("Java Puzzlers" webcast from Javapolis, with Neal Gafter).

So if (a > b) is apparently more confusing than if (a.compareTo(b) > 0)? I totally get that arbitrary overloading isn't very javalike, but allowing specific operators (.compareTo overloads comparison ops, .addTo overloads + etc.) for classes tagged with particular interfaces doesn't seem that much of a mess. Hey ho.

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • Like most Java droids, he read somewhere that operator overloading was evil and is now spewing the party line like a good little toadie.

    The belief that operator overloading is evil stems largely from abuse by the C++ crowd. However, Ruby has shown me that it can be extremely useful without being the least bit confusing.

    • OTOH you can also abuse it in Ruby. (And Perl.)

      It’s just very much like Java to be sternly patriarchal about things that could potentially be harmful. “No multiple inheritance for you! No operator overloading for you! No inheriting from base type classes for you!” Etc.