5 ms·
Scala 3 is a huge change. As someone who used Scala for years, but always wondered whether they can retain their users with competition from Kotlin, I'm extreme
by rethab 6y ago
Scala 3 is a huge change. As someone who used Scala for years, but always wondered whether they can retain their users with competition from Kotlin, I'm extremely curious what this will mean for Scala in the long run.
I'm skeptical, because the cost to migrate is big. But I'm hopeful, because Scala is a language I like to write code in.
Edit: why am I skeptical? I know scala 3 is largely meant to be backwards compatible. But scala has always been a language of many styles ("java without semicolon" vs "haskell compiled with scalac"). All this new syntax in scala three adds a whole new dimension to this issue.
- klysm 6y agoYeah there are certainly some Python 2/3 fears for Scala 3, but the plan and upgrade path seem much more thought out
- petre 6y agoIs there a document with the differences between 2.13 and 3?
- pjmlp 6y agoOn the JVM, I think Scala won't have any major issues it is just another guest language and isn't used to sell InteliJ licenses. Kotlin is chaining itself to Android, it will rule there thanks to Google's sponsorship, on everything else it is just yet another language to chose from with a weaker eco-system, used to sell InteliJ licenses.
- dtech 6y agoKotlin has significant support from the largest Java ecosystem: Spring. In my experience it's also much more compatible with Java/JVM libraries. In Scala that's perfectly possible but leads to very un-idiomatic code, in Kotlin you barely notice.
- cies 6y agoScala has an issue with the concept of "idiomatic code". I'd say when it comes to "idiomatic code", Go and Scala are at the opposite sides of the spectrum.
- pjmlp 6y agoSpring supports everything that helps their bottom line. Where are the Groovy, Scala, Clojure support nowadays?
- imtringued 6y agoGroovy is still alive within the context of Grails (which is basically a very nice wrapper around Spring) and Micronaut (which is a direct competitor to Spring). Micronaut officially supports Java and Kotlin as well.
- pjmlp 6y agoI was referring to the way Spring used to sell that they supported those languages, just like they do with Kotlin now.
- lmm 6y ago> In my experience it's also much more compatible with Java/JVM libraries. In Scala that's perfectly possible but leads to very un-idiomatic code, in Kotlin you barely notice. I think that's actually reversing as Kotlin and Java diverge. E.g. interop with Java Optionals is very easy in Scala (and they obviously correspond directly to Scala Options) whereas it's harder to make them fit with Kotlin nullable types. And Kotlin's "suspend functions" are unlike anything else and mean you have to understand a concept of "inline" that changes the semantics of the function it applies to; e.g. calling a Java function that takes a callback from an async function is straightforward in Scala, but not so much in Kotlin.
- jillesvangurp 6y agoThe crucial point here is if Scala 3 maintains backwards compatibility with Scala 2.x. If not, it's effectively a new language and then the game becomes which of the existing scala code bases will switch over and when. There's a large amount of existing Scala code out there and embarking on a migration of that stuff is going to take very long. We're talking many years here potentially. The few Scala projects I've dealt with, even updating to minor releases of Scala was a big deal. The python 2 to 3 transition took well over a decade. You have similar discussions in what remains of the Perl community around v5 and v6. IMHO what Oracle has been doing with Java in recent years is impressive in the sense that they provide a credible upgrade path and put a lot of effort into that while still adding non trivial new language features. But it has a price of added complexity or compromises with new features and unfortunate legacy features that are not going to way. Javascript and typescript have the same issue. Javascript has a lot of weird legacy features and typescript preserves backward compatibility with that weirdness and attempts to engineers around that. I'm currently using Kotlin across Android and Server (mostly) with an intention to also use it on IOS and Web very soon. Its multi-platform capability is increasingly a good selling point and I love how that ecosystem is booming in the last year/months. I'm definitely an early adopter of multi-platform but this seems to be one of those things where it seems like a bet worth making at this point. Kotlin is of course a much younger language so it does not have a lot of legacy yet burdening it. Yet, Jetbrains seems to be good at managing new features while minimizing disruption, dealing with necessary deprecations, and generally not breaking compatibility. Their experience as tool makers gives them a unique edge over a lot of other languages. Arguably Kotlin emerged as a rejection of Scala to replace Java by Jetbrains: they considered it and dismissed it as an option and then embarked on a journey to create their own language. I think the success of the language (relative to Scala) seems to indicate that that wasn't a bad choice. Scala intended to do many of the same things but it just never caught on with people actually doing those things to the extent that Kotlin seems to be catching on. The transition from Java to Kotlin is a lot less of a hard sell than the transition to Scala was. Though I know plenty of people that stubbornly stick with Java still. Of course early adoption in the Android community was a big deal. But then you could argue that that same opportunity was there for Scala to take and I don't think much serious effort ever was put in that notion. The need for something else than Java was quite big there and a big driver for this. All Kotlin did was provide a credible upgrade path to Java developers and the Android community jumped on it because it was easy to switch and obviously better. You see the same happening in the Spring community which is increasingly Kotlin centric. Meanwhile Scala seems to be bleeding mind-share to more pure (for lack of a better word) languages Crystal, Elixir, etc. or more system oriented languages like Rust, or indeed Kotlin. It's a bit of a repeat of what happened to the Ruby community a few years ago. Certain types of people were very passionate about that language for a while and then moved on.
- aliakhtar 6y agoI have a pretty large codebase written in scala 2.12 or so (whatever the version was around late 2018). I'd like to migrate it to scala 3. Any ideas how hard it'll be?
- dtech 6y agoStart with migrating to scala 2.13, scala 3 can run all non-macro 2.13 code that doesn't emit deprecation warnings and can consume most 2.13 libraries. The widely-used ones it can't will get updated. For more information see https://scalacenter.github.io/scala-3-migration-guide/docs/compatibility.html https://scalacenter.github.io/scala-3-migration-guide/docs/c...
- lmm 6y agoPretty easy unless you were writing custom collections or custom macros, IME.
- AheadOfTime295 6y agoScala 3 supports braceless syntax, aka significant indentation, aka "YAML is to JSON as Scala 3 is to Scala 2" https://dotty.epfl.ch/docs/reference/other-new-features/indentation.html https://dotty.epfl.ch/docs/reference/other-new-features/inde... There was quite some debate on this, going on strong.
- silon42 6y agoYuck... personally I'd want a Lint that would disallow many such syntax differences from Java: - force use of () - force use of ; - etc...
- cryptos 6y agoI consider this a totally useless "innovation"! As if Scala didn't have already enough possibilities to express things, no we are able to leave out braces, what makes scanning code even harder and will lead to an ugly mixture. I would accept it, if they would decide to drop the traditional syntax. But adding yet another style, just for the sake of it, is waste of resources (of the Scala creators and Scala users). There is a good article about the "strangeness budget" of languages, and I think that Scala doesn't spend it wisely. https://steveklabnik.com/writing/the-language-strangeness-budget https://steveklabnik.com/writing/the-language-strangeness-bu...