|
|
|
|
|
by qammm
4703 days ago
|
|
Well, with "Scala with its everything and the kitchen sink feature set" I mean that Scala incorporates almost all language features one can think of for a statically compiled programming language (I don't think it makes sense to distinguish if a certain feature is provided by the language itself or a library as in Scala that distinction is fuzzy):
- type inference
- classes
- interfaces (sort of: traits)
- methods
- variables (var)
- immutable values (val)
- higher order functions
- singletons
- functional programming: map, flatMap, reduce/fold, ...
- actors
- coroutines (I think there was a compiler plugin for that)
- implicits
- powerful type parameters
- Futures
- it even has a turing complete type system That is good and bad. Good: you can probably find good use for every feature Scala has. Bad: On a sufficiently big project with one or more extra clever developers most probably every feature will be used and that will make it extra hard to understand for normal software developers that have to maintain it for long years after the original extra smart developer already left the company. See it a bit like that: On a hard to understand scale with 1 being easy to understand und 10 being extremely hard to understand Java projects can go from 1 to 6 and Scala projects can go from 1 to 10. Personally I like simple languages more. And I don't need a compiler to catch errors that a unit test would also catch. |
|
But if one compares Scala to languages which are actually used in the wild like Java, C#, PHP or C++; Scala's footprint is just incredibly small.
All of the features you mentioned are available in languages like Java or C#, too. The difference is that in most cases the implementation is so poor and incoherent, that the feature is next to useless.
I guess one just "sees" more language features being used in Scala, because almost everything which ships in the language makes some sense, while in Java/C#/PHP/C++ you have tons of utterly useless "features" which don't add any benefit, but still force people to learn them in case somebody else used them.
I have never seen "On a sufficiently big project with one or more extra clever developers most probably every feature will be used" happen in real life. In my experience one of the strengths of Scala is the way one can use some advanced feature where it makes sense, without having it bleed through the whole code. Compare that with Java's, C#'s "Oh, you used some complicated Generic type over there? Guess what, we will make every user suffer from it throughout your whole code base!"
In a sense, I prefer a language (Scala) which ships with 100 features where 90 of them make sense to a language which ships with 400 features where only 50 make sense, like C# (multiply "feature" count by 10 for C++).
Well, using the compiler means that it will also catch errors which you haven't written unit tests for. Tests can't prove the absence of certain categories of errors, compilers can.