5 ms·
Then can you explain why Scala's spec is so small? Even Java's spec is much larger. I'll tell you the answer: because the language is comparably well designed,
by valenterry 4y ago
Then can you explain why Scala's spec is so small? Even Java's spec is much larger.
I'll tell you the answer: because the language is comparably well designed, with a lot of foresight, and the fundamental features work well together. Also you are totally right about XML. This was a total mistake and in fact already has been removed from the language - I think a few years ago.
Maybe you still have the old Scala in your head? That would explain your post a bit I guess.
> Programming language features aren’t “stolen”, since they aren’t really “owned” by any given language
I agree with that though and I think it's great that Java is progressing. There is no shame in copying the good things.
- MajimasEyepatch 4y agoPart of the reason that Scala's spec is so small that so many features are incredibly generic. Concepts like implicit are overloaded in a bunch of different ways and give rise to powerful but complex patterns that you need to understand to use the language, even if they're not strictly required for it. And since all of these different features and patterns are optional, you end up with every Scala codebase using a slightly different subset of the language, and different communities evolving very different ways of doing things. Look at Spark code vs. ZIO code and it's like night and day in a lot of ways. Scala 3 improved the situation a bit by breaking the "implicit" concept down into a few discrete concepts, but the language is still incredibly expansive, despite the "look how few keywords we have" talking point. Honestly, I do think that modern Scala is very well designed. But unfortunately the ecosystem and tooling and corporate support for it never really got to the point where it feels like a practical choice for most teams.
- kaba0 4y agoZIO and other purist FP code bases are probably not the most common, but definitely not the most well loved aspect of Scala — pragmatic FP would be that, that uses local mutability when that is readable, but prefers an immutable public API.
- valenterry 4y agoI think ZIO is really a very pragmatic appraoch to FP, similar to Monix (which is a bit less comprehensive).
- Kwpolska 4y ago> Then can you explain why Scala's spec is so small? Even Java's spec is much larger. Are the two specs comparable? Looking at the Scala 2.13 [0] (I can’t find a Scala 3 spec) and Java 19 [1] specs, while the Java spec is much longer page-wise, it is also much more formal and detailed: * The Java spec sometimes defines things that might count as part of the standard library (eg. how threading and wait/notify work). * The Scala specs just says “Scala source code consists of Unicode text.”, but the Java specification says what Unicode is, and talks about UCS-2/UTF-16 and why chars have surrogates (over almost two pages). * The Java specification also talks a lot about the JVM and bytecode. The Scala spec does not include any details or assumptions about the underlying execution environment. * Scala also delegates a lot of things that you would consider part of the language (e.g. the + operator for integers) to the standard library. Also, how do I figure out how large an Int can be in Scala without reading stdlib docs or writing a program to query Int.MaxSize? * Similarly, comparing the keyword count of Java and Scala doesn’t necessarily yield sensible results, since Java considers `int` to be a keyword, but in Scala, this is just the name of a standard library class. Also, the size of the language specification has nothing to do with how easy a feature is to grasp. Implicits may take 8 pages in the specification, but they are difficult to understand and tricky, especially if the implicit keyword meant 4 semi-related things in Scala 2. --- > Maybe you still have the old Scala in your head? That would explain your post a bit I guess. Which “old” Scala? Scala 3 still has ~all the features of Scala 2. It also has two separate syntaxes, a Java-like and a Python-like syntax, to add even more confusion and even more things to learn. > This was a total mistake and in fact already has been removed from the language - I think a few years ago. From the Scala 3 docs [2]: > XML Literals are still supported, but will be dropped in the near future, to be replaced with XML string interpolation[.] [0] https://scala-lang.org/files/archive/spec/2.13/spec.pdf https://scala-lang.org/files/archive/spec/2.13/spec.pdf [1] https://docs.oracle.com/javase/specs/jls/se19/jls19.pdf https://docs.oracle.com/javase/specs/jls/se19/jls19.pdf [2] https://docs.scala-lang.org/scala3/reference/dropped-features/xml.html https://docs.scala-lang.org/scala3/reference/dropped-feature...
- emodendroket 4y agoFor the operator thing, isn't that just because there is no difference between an operator and a method in Scala?