3 ms·
What happens when you don't have operators and sugar? You get ten-times-worse unreadable mess like anonymous inner subclasses. You get a dirty mix of a+b and a.
by JulianMorrison 17y ago
What happens when you don't have operators and sugar? You get ten-times-worse unreadable mess like anonymous inner subclasses. You get a dirty mix of a+b and a.add(b). And finally, you get a language that has to be extended with revisions of the core, rather than with libraries.
Scala's operators are OK, but Haskell's are better yet because of the concept of a typeclass. You can't abuse + because it comes bundled with -, instances which support < are guaranteed to support ==, and so on. Operators actually have meanings that aren't arbitrary.
- blasdel 17y agoBeyond that, in Haskell you can make your own infix functions with arbitrary symbols, arbitrary meaning, and arbitrary precedence when that's what you want.