3 ms·
> 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
by 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?
- Kwpolska 4y agoPretty much, yes. Operators being methods of stdlib classes and being a guest language on the JVM are two things that let the spec be shorter by omitting details a developer needs to know.
- emodendroket 4y agoI suppose I've always seen the audience for the spec as language implementors, not users, who are unlikely to look at it.
- valenterry 4y agoYou make some valid points. I still think after removing the points you mentioned, Scala's spec will still be shorter - but I'm too lazy to do that. And reasons are for example that the language just has less exceptions. Like the + "operator" which is just a method. And Int just being a datatype - no need to put this in the spec. Or that "int" is not a keyword in Scala - well, I think that is totally a good thing and also comparable, why not? > Also, the size of the language specification has nothing to do with how easy a feature is to grasp Sure, but your original claim wasn't just "it's hard to learn Scala" because with that claim I would agree. > Scala 3 still has ~all the features of Scala 2 Scala 3 has removed a lot of features. In particular powerful features like Scala 2's macros. So what you say is just wrong (the tilde in front of the all really doesn't make it better). > 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. That's a valid point, but if this is your level of complaint, then you must hate Java much more than Scala. It has way more warts and confusions than Scala. I know both languages in and out. > > XML Literals are still supported, but will be dropped in the near future, to be replaced with XML string interpolation[.] Careful here. XML literals are still supported (even though deprecated), but that is not xml support. XML support has been completely removed from the compiler and is now in a library that needs to be imported. This is different from before, where XML was really built into the language. In other words: try to use XML without that library and it will simply not compile.
- Kwpolska 4y ago> Scala 3 has removed a lot of features. In particular powerful features like Scala 2's macros. So what you say is just wrong (the tilde in front of the all really doesn't make it better). Sure, macros were removed, but they were an experimental thing in Scala 2 (and another case of language bloat IMO). If you look at features used in day-to-day programming (in [0] or [1]), the list of removed features is quite short, and many of them are very minor things that can be usually automatically replaced, and some of them were still supported in Scala 3.0 (perhaps with a compatibility flag). [0] https://docs.scala-lang.org/scala3/guides/migration/incompat-dropped-features.html https://docs.scala-lang.org/scala3/guides/migration/incompat... [1] https://docs.scala-lang.org/scala3/reference/dropped-features/index.html https://docs.scala-lang.org/scala3/reference/dropped-feature...
- darksaints 4y ago> Which “old” Scala? Scala 3 still has ~all the features of Scala 2. You linked to a page that has several actual dropped features from Scala 3. If Scala 3 didn’t drop features, it would still be Scala 2. What exactly is the point of all this edgelordery? We get it, you think Scala is uncool, but that’s just like your opinion man. Did you really jump onto a comment about Scala just to shit on Scala? I’m horrified to think of using a language that someone like you might actually think is cool.
- Kwpolska 4y agoThe list of dropped features isn’t very long, and many of them are very minor or niche things. Nothing comparable to Python 2 → 3, for example. I started by commenting on the OP’s statement calling Scala “cool” and talking about the feature bloat in Scala (that makes it uncool and hard to learn).