On Tuesday, 3 December 2013 at 12:41:40 UTC, Russel Winder wrote:
On Tue, 2013-12-03 at 13:29 +0100, Tobias Pankrath wrote:
[…]
Does scala have arbitrary operators like Haskell? Looks
useless in D. If you have an operator '+' that should not be
pronounced 'plus' you are doing it wrong.
Yes.
a + b
could be set union, logic and, string concatenation. The + is
just a
message to the LHS object, it determines what to do. This is
the whole
basis for DSLs.
I really have no problem with operator overloading, but set union
(∪), logic and (∧) and string concatenation (∘) do have well
defined and commonly used symbols.
I would not argue against adding these to the language via a
general mechanism and indeed then it might be useful to have a
name for a user defined wtf-operator ?!?!. But if you overload an
operator (+) it should be some kind of addition.