3 ms·
In a well-designed, flexible language (which includes Scala), operators are not a special case. In fact, in Scala, they are just methods, so there's no arbitrar
by tikhonj 14y ago
In a well-designed, flexible language (which includes Scala), operators are not a special case. In fact, in Scala, they are just methods, so there's no arbitrary line between the two!
I personally like the Haskell/OCaml approach of having operators just be normal functions that happen to be parsed in infix position. It's simple, elegant, uniform and flexible.
Either way, the core idea is that operators should be nothing special.
- kyllo 14y agoAnd Lisp takes this idea one step further by having operators just be normal functions that are in the prefix position like normal functions. This, combined with the explicit parentheses to denote evaluation, mean that operator precedence is not even an issue in Lisp.
- lmm 14y agoYes, that's exactly my point. You wouldn't use symbols for the names of normal functions (at least I hope you wouldn't).