[HN Gopher] Scala 3 Migration: Report from the field
       ___________________________________________________________________
        
       Scala 3 Migration: Report from the field
        
       Author : AzzieElbab
       Score  : 107 points
       Date   : 2025-02-06 17:54 UTC (5 hours ago)
        
 (HTM) web link (blog.pierre-ricadat.com)
 (TXT) w3m dump (blog.pierre-ricadat.com)
        
       | philipkglass wrote:
       | This is a good report. I started a project last year on Scala
       | 2.13, but had all Scala 3 compatibility features/warnings enabled
       | from the beginning. It sounds like it should be an easy upgrade
       | in the future as long as I don't rely on macros or libraries that
       | rely on macros. I've tried to stick to libraries that already
       | have Scala 3 releases or that come from plain Java.
        
         | noelwelsh wrote:
         | It doesn't matter if libraries are stuck on 2.13 because 1) you
         | only depend on their compiled output and 2) you can use Scala
         | 2.13 code from Scala 3. That said, the vast majority of the
         | open source ecosystem has Scala 3 releases by now.
        
       | cbeach wrote:
       | Very useful document, thanks Pierre!
       | 
       | Our company is still on 2.13 and probably will be for a long
       | time. The reality is that we need rock-solid library support
       | across all transitive dependencies, and mature battle-tested
       | tooling.
       | 
       | I like that the Scala language continues to improve, but its
       | appeal in real-world enterprise applications took a hammering due
       | to the backwards-incompatible changes in Scala 3, shaky tooling
       | and ecosystem issues.
       | 
       | Also the elephant in the room - the Scala Center and toxicity
       | within the Scala community.
       | 
       | The Scala Center Executive Director is a political sciences
       | graduate with no commercial Scala experience, who gave this
       | expletive-laden sexualised rant at a Scala conference:
       | 
       | https://x.com/jdegoes/status/1633888998434193411?s=46&t=V_LF...
       | 
       | When this ugly performance was called out by a member of the
       | Scala ecosystem, it was the guy that called it out that got
       | brigaded and cancelled, while the executive director Darja
       | Jovanovic was defended by the community, and remains in place.
       | 
       | And then there's Scala Center Community Representative Zainab
       | Ali, who led an orchestrated witch hunt against a contributor to
       | the Scala ecosystem. She ended up in the UK High Court for her
       | role in this, and admitted fault (defamation) and settled.
       | 
       | https://pretty.direct/statement
       | 
       | Like the executive director, the community rep remains in place
       | at Scala Center:
       | 
       | https://www.scala-lang.org/ambassadors/
        
         | paulddraper wrote:
         | Most of the Scala ecosystem exists outside of the Scala Center.
         | 
         | Same with Rust, Go, and any other language.
        
         | michaelmrose wrote:
         | The rant was
         | 
         | "whoever it is I challenge that person to grow some fucking
         | male anatomy and come and speak to me ... you little female
         | anatomy plural you are just fucked up"
         | 
         | Fairly shocking language but also pretty devoid of context
         | although I come to suspect it has to do with people talking
         | behind her back regarding the second part.
         | 
         | The second case appears to be a fellow who was publicly libeled
         | professionally ruined and then sued the shit out of the
         | offender. According to him this was solely because he had
         | dumped community rep. In the settlement they admitted that they
         | had circulated the letter claiming he was a serial sexual
         | harasser based on no evidence but unverified claims. Settled
         | for a rather paltry sum of PS5000.
         | 
         | So community rep and contributor split for whatever reasons and
         | then she shit talks him spreading possibly true likely untrue
         | claims that he's a particular type of jerk which she likely
         | can't back up with anything like evidence other than her own
         | now terminated relationship.
         | 
         | If they didn't fire her they probably believe that she was in
         | the right but settled.
         | 
         | No part of this probably belonged as part of professional life
         | and should have stayed between them. I don't believe enough
         | evidence exists for people who don't know either party to
         | declare anyone a villain and if I had any professional
         | involvement with either I would simply pretend none of that
         | existed and move on.
         | 
         | If I was merely using the code I would definitely ignore it.
        
           | tsss wrote:
           | This sort of behaviour is so pervasive among certain
           | influential circles, which makes it hard to ignore.
           | Thankfully, the conflict seems to have died down a bit in the
           | last 2 years and I'm looking forward to changes in Scala 3
           | that make the libraries that those people develop mostly
           | superfluous.
        
         | pie_flavor wrote:
         | Organizational political drama is just about the least relevant
         | thing possible to whether you update from Scala 2 to Scala 3.
         | The ultimate fate of Jon Pretty does not impact the behavior of
         | macro annotations.
        
       | paulddraper wrote:
       | I didn't know the ecosystem wasn't on 3.
       | 
       | It was released May 2021.
       | 
       | It is a big change though.
        
         | AlexITC wrote:
         | Most of the ecosystem is on Scala 3, I think Spark would be the
         | biggest piece pending to upgrade.
        
       | dylanowen wrote:
       | This is a great write up! For people using gradle to compile
       | scala (definitely not my first choice) the initial hurdle to
       | migrating individual modules has been fixed! I'm guessing it'll
       | be in gradle 8.13 https://github.com/gradle/gradle/pull/31118
        
       | dtech wrote:
       | I left the Scala ecosystems (mostly) a year or 4 ago, right
       | around the release of Scala 3. It's a shame that the
       | compatibility and tooling situation doesn't seem to have improved
       | much since then. The Scala devs always said they wanted to avoid
       | a Python 2->3 situation, but it seemed like they didn't quite
       | achieve that.
        
         | dkarl wrote:
         | I think you should read this report. They made heavy use of
         | many advanced features of Scala 2. Few codebases look like this
         | (and very, _very_ few need to) yet they were able to do it.
         | 
         | Moreover, they didn't _need_ to do it. What makes it similar to
         | the Python 2 - > 3 situation is the lack of urgency to migrate,
         | because nobody suffers for not migrating. That's a good thing.
        
           | merb wrote:
           | Most people used advanced features, even if they were hidden
           | behind libraries. Even if you've just had a codebase which
           | only used playframework.
        
             | noelwelsh wrote:
             | If they are in libraries it doesn't matter, because you can
             | use Scala 2.13 code in Scala 3.
        
             | AlexITC wrote:
             | It definitely took a while for most libraries to catch-up
             | with Scala 3, now, I don't see anything is missing in the
             | main area I work with (web development), playframework
             | already works for Scala 3.
        
           | foolfoolz wrote:
           | i was surprised to see such advanced type features. i worked
           | at a large scala company. we wouldn't let most of this stuff
           | through code review. it generally is the kind of magic that
           | saves a tiny amount of code at a high cost of complexity.
           | sounds like this was the authors pet project and wanted to
           | explore instead of write maintainable code
        
         | kokada wrote:
         | I don't know, if anything the Scala situation seems much worse
         | than the Python situation. The language looks completely
         | different and there is no easy migration path (not that Python
         | had one, but at least the language was almost the same and you
         | could with some effort write code that worked in both
         | versions).
         | 
         | We are in Scala 2.13 and while there are talks about migrating
         | there is no actual plan. Looking at this blog post the
         | situation seems to be more dire than I initially expected. I
         | think we will only end up migrating when the situation becomes
         | unsustainable (libraries stop supporting Scala 2).
        
           | adamwk wrote:
           | Odersky forcing through major syntax changes for Scala 3 was
           | such an unforced error. It's baffling add new syntax on top
           | of major semantic changes to the type system.
        
             | Pet_Ant wrote:
             | But did it provide a gain in power and soundness? There
             | issues with the 2.x system.
        
               | merb wrote:
               | Most programming languages have unsound features.
        
             | hawk_ wrote:
             | Stroustrup said "There's two kinds of PLs, ones that people
             | complain about and ones that nobody uses."
             | 
             | Odersky made Scala3 become a language that nobody uses and
             | people complain about!
        
             | threeseed wrote:
             | Problem is he's a full time academic.
             | 
             | So he doesn't care if this amazing feature he's invented
             | has no IDE support.
             | 
             | Or if the Scala tooling ecosystem is so ridiculously poor.
        
           | sidkshatriya wrote:
           | I don't use Scala but it will always be better than Python
           | 2/3 because of compile time type checks. If it compiles it
           | should work. In the case of Python 2/3 you could often
           | encounter upgrade issues during runtime !
        
             | adamc wrote:
             | That can happen in Scala as well because of shared
             | binaries, as is reported in this thread.
        
               | threeseed wrote:
               | It's a completely different situation compared to Python.
               | 
               | With Scala 2.13/Scala 3 they both compile down to an
               | intermediate format called TASTy which allows binary code
               | to be shared. You don't get the same binary
               | incompatibilities you do with other languages.
        
               | sidkshatriya wrote:
               | That is why I said it "should" work. There are always
               | some really weird edge cases. My broader point holds
               | true. Scala upgrade is not even close to Python 2/3
               | debacle
        
         | AlexITC wrote:
         | While the tooling isn't perfect, it has improved considerably
         | over the last years, I remember when IntelliJ couldn't deal
         | with Scala 3 but now, it rarely complains.
         | 
         | Related to Python 2->3, I don't see how Scala 2->3 compares,
         | there are clear migration guides + tools to help re-writing to
         | switch between the new/old syntax, I have done many migrations
         | and I have used these tools since the time when Scala 3 was
         | launched (I admit that I reverted a migration at that time).
        
       | slavomirvojacek wrote:
       | I am wondering whether with GenAI, migrations like this one will
       | be less and less painful, and therefore more people will be able
       | to migrate to newer technologies/versions sooner and quicker.
        
         | aiono wrote:
         | Why use GenAI for this use case? Instead you can write
         | transformers from one syntax to another syntax that will not
         | hallucinate and work correctly every time. The conversion is
         | well-defined.
        
           | nsonha wrote:
           | Or use GenAI to write the codemod :)
        
       | lopatin wrote:
       | I only allow myself to use Scala these days if follow some rules:
       | no sbt (just Maven) and no Scala libraries (just Java ones). I
       | never used fancy stuff like Cats anyways. Curious to hear who
       | actually does, and for what.
        
         | threeseed wrote:
         | I use ZIO (https://zio.dev) and nothing really like it exists
         | on any platform.
         | 
         | You can wrap any computation in a single ZIO object e.g.
         | normal, callback, future, promise etc. Which you can then chain
         | together in different ways e.g. run them in parallel,
         | sequentially, race them against each other and kill the loser,
         | schedule in elaborate ways, run with a timeout and then run
         | another if it's exceeded etc.
         | 
         | And it will execute this either using normal or virtual threads
         | i.e. fibers without locks so it's extremely fast.
         | 
         | But the incredible part is that it does all of this whilst
         | seamlessly handling every type of error. Which if you've ever
         | written complex concurrent code is extremely hard to get right.
        
         | AlexITC wrote:
         | sbt is way better than what it used to be, also, check-out
         | scala-cli which is very nice.
        
       | theLiminator wrote:
       | Back when I used to use Scala, the biggest PITA was how every
       | minor version bump you'd run into binary version
       | incompatibilities that you'd only run into at runtime. Has that
       | situation changed?
       | 
       | I've always felt that Scala the language was always pretty nice,
       | but Scala the ecosystem/tooling was moderately painful to work
       | with. It was getting better over time, but they lost all the
       | momentum they had.
        
         | philipkglass wrote:
         | Yes, that's one of the big improvements in Scala 3.
         | 
         | https://docs.scala-lang.org/overviews/core/binary-compatibil...
         | 
         |  _For Scala 3, the minor version is the second number in a
         | version, e.g., 2 in v3.2.1. The third number is the patch
         | version. The major version is always 3.
         | 
         | Scala 3 guarantees both backward and forward compatibility
         | across patch releases within a single minor release (enforcing
         | forward binary compatibility is helpful to maintain source
         | compatibility). In particular, this applies within an entire
         | Long-Term-Support (LTS) series such as Scala 3.3.x.
         | 
         | Scala 3 also guarantees backward compatibility across minor
         | releases in the entire 3.x series, but not forward
         | compatibility. This means that libraries compiled with any
         | Scala 3.x version can be used in projects compiled with any
         | Scala 3.y version with y >= x.
         | 
         | In addition, Scala 3.x provides backward binary compatibility
         | with respect to Scala 2.13.y. Libraries compiled with Scala
         | 2.13.y can be used in projects using Scala 3.x. This policy
         | does not apply to experimental Scala 2 features, which notably
         | includes macros._
        
         | dionian wrote:
         | yes, and you can even use 2.13 binaries in 3
        
         | jeremyjh wrote:
         | It still seems bizarre to me that the Java ecosystem relies
         | upon code-sharing through precompiled binary packages. Compared
         | to for example Rust or Elixir where you only download source
         | and build it locally so that everything is built with the same
         | compiler and environment. This makes it absolutely trivial to
         | debug your dependencies and even fork them when necessary. Most
         | Java programmers wouldn't ever dream of doing that.
        
       | virtualwhys wrote:
       | Migrated a Scala 2.8(!) era codebase to Scala 3.
       | 
       | As OP explains, macros and abstract type projections tend to be
       | the biggest pain points in complex applications; otherwise, with
       | Scala Rewrite tool it's pretty straightforward.
       | 
       | I think it's more inertia than anything else that more Scala 2
       | companies don't migrate.
       | 
       | Unpopular opinion, but setting a Scala 2 sunset time would spur
       | companies into action :)
       | 
       | As it stands Akka (previously Lightbend, previously TypeSafe) is
       | the maintainer of Scala 2, and derives part of its revenue from
       | Scala 2 support contracts so there's even less incentive to
       | migrate when there's no EOL date as Python 2 (eventually) had.
        
       | codr7 wrote:
       | That's how I learned to do migrations/major refactoring from my
       | mentors back in the days.
       | 
       | First brute force it, observe but don't panic, until you don't
       | get any further.
       | 
       | Then start over and do it properly.
        
       | caterama wrote:
       | Scala used to be my hobby / enthusiast language. Introduced to it
       | through a college course, and used a bit through school. Later, I
       | would use it for Advent of Code, tinkered with a Scala Play
       | webapp, and dream about using it professionally. Rust has almost
       | completely filled that void now. Rust is native, I'm not waiting
       | on the 1.0 release of `scala-native` anymore. The community
       | around Rust seems to be enthusiastic and growing, as opposed to
       | languishing for Scala. I hold some reservations about Rust in
       | terms of how complicated it is. Despite having used it for an
       | amount of time that I would be feeling comfortable in most
       | languages, I am still not comfortable and continually encounter
       | _stuff I don't understand_.
       | 
       | RIP Scala, I will miss you! You showed me the joy of pattern
       | matching, functional OO, currying, how to use `map` `flatMap`
       | `fold`, etc. All things with continued influence! <3
        
         | threeseed wrote:
         | I have been writing Scala and Rust everyday for the last few
         | years.
         | 
         | I actually don't see the two overlapping all that much. Rust is
         | a terrible backend language compared to Scala/JVM. When you are
         | dealing with real world concurrency i.e. error/thread
         | management Rust's memory management model becomes unusably
         | complex very quickly. And the entire ecosystem lacks maturity
         | i.e. the majority of libraries I use are not at version 1.
         | 
         | Whereas from Scala you can just use any Java library e.g.
         | Vertx, Spring almost all of which have commercial, enterprise
         | support and continue to be proven time and time again. It
         | almost always just works.
         | 
         | Rust's strength is in desktop apps e.g. Tauri and low-level
         | programming.
        
       ___________________________________________________________________
       (page generated 2025-02-06 23:00 UTC)