text: cayhorstmann : 2011 : December | Oracle Community
  Operator Overloading Considered Challenging Blog
  Posted by cayhorstmann-3071947 Dec 5, 2011
  Java has no operator overloading. I always thought that was a shame. For example, BigDecimal would be a lot more popular if you could write a * b instead ofa.multiply(b).
  Why doesn't Java have operator overloading? Well, C++ has it, and people kept saying that it makes code hard to read. Actually, in C++, you can have a library class vectorand write v[i], thanks to operator overloading. In Java, we have unsightly v.get(i) and v.set(i, newValue). Easier to read? I think not.
  Of course, someone somewhere out there abused operator overloading in C++, doing something silly like overloading% for computing percentages. The horror. It's actually pretty hard to do much abuse in C++ because you can only overload the standard operators. Personally, I never ran into anything scary
  (1 /: (2 to 10)) (_ * _)
  2.to(10).foldLeft(1)((x, y) => x * y)
  It still looks like magic if you don't knowfoldLeft. And if you do, the operator version is simpler.
  It's a nifty trick in Scala that an operator ending in a colon is right-associative, and elem +: coll is really the same as invoking the +:method on coll.
  Did you notice the asymmetry? Why isn't it :++ for the first one? I pointed that out and was told that++ is prettier and shorter.
  It gets a bit confusing when elem happens be a string.
  Set("Fred") + "Wilma" // Set("Fred", "Wilma")
  Set(42) + "Wilma" // "Set(42)Wilma"
  Set(42) ++ Set("Wilma") // Set(42, "Wilma")
  In the second case, it doesn't form a Set[Any] with 42 and"Wilma", but it coerces Set(42) to a string and concatenates the two. Ouch.
  I asked why it wasn't so and was told that += is prettier and shorter. Yes, it is, but actually there is a:+=, because Scala always synthesizes anop= from any operator. And it's subtly different from+=.
  For lists, the prepend operator is ::, because, well, it's always been so. For example, 1 :: 2 :: 3 :: Nil makes List(1, 2, 3). And we don't want to change it to +: because, well, it's never been that. And we don't want to replace +: with:: because then we lose the beautiful symmetry with:+, even though we don't care about that symmetry when it comes to :++ or :+=.
  Use asymmetric operators for asymmetric operations.:: for cons, or | for shell pipes, are bad role models.
  You have one chance. Operators are powerful stuff. Once people are used to :: or | or!=, they will refuse to switch.