3 ms·
> compared to Haskell, ML and to a lesser extent Python, Scala's syntax is rather ugly and unnecessarily verbose I have never worked extensively with Haskell o
by Cyph0n 9y ago
> compared to Haskell, ML and to a lesser extent Python, Scala's syntax is rather ugly and unnecessarily verbose
I have never worked extensively with Haskell or ML, but what I can say is that Scala's syntax is better than that of most other mainstream languages.
Three of Scala's syntax niceties are:
1) No semicolons
2) No braces required for one-line functions
3) No constructor required: instance arguments passed in class declaration
- s4vi0r 9y agoTo add onto this, its not one line functions but rather functions whose body is a single expression. You can do a big for comprehension, or a if/else, or a big chain of function calls, etc. without having to add brackets. In practice you often end up not really using braces that often when writing FP style Scala.
- yawaramin 9y agoThe constructor syntax can be a source of confusion. People have to be taught that the class declaration parameter list is actually the primary constructor, and that the body of the class is also the body of the primary constructor, except for any method definitions, some of which may be secondary constructors! Scoping is hard.