19 comments

  • game_the0ry16 hours ago
    I am not a scala fan and do not care for it, but I upvote for the thorough thought process, breakdown, and debugging of the problem. This is how technical blogs should be written. AI aint got shit on this.
    • sema4hacker12 hours ago
      &gt; I was refreshing one of our services. Part of this process was to migrate codebase from Scala 2.13 to Scala 3.<p>My first question was: why?
      • pxc10 hours ago
        Scala 3 is sorta a new language, bringing a lot of improvements to the type system: <a href="https:&#x2F;&#x2F;docs.scala-lang.org&#x2F;scala3&#x2F;new-in-scala3.html" rel="nofollow">https:&#x2F;&#x2F;docs.scala-lang.org&#x2F;scala3&#x2F;new-in-scala3.html</a><p>It also looks like it has some improvements for dealing with `null` from Java code. (When I last used it I rarely had to deal with null (mostly dealt with Nil, None, Nothing, and Unit) but I guess NPEs are still possible and the new system can help catch them.)
      • lmm4 hours ago
        If you&#x27;re going to &quot;refresh&quot; a codebase you probably want it to be on the current version of things. Old dependencies rot, like it or not. I don&#x27;t think there&#x27;s any timeframe for Scala 2 EOL yet, but new development is happening in 3.
      • dionian5 hours ago
        Why not though the upgrade process from 2.13 to 3 is pretty smooth. And you get all the new language features. I can think of a few that I actually like. I’ll just mention enums because it’s a good example.
  • _old_dude_16 hours ago
    In Scala 3, the inline keyword is part of the macro system.<p>When inline is used on a parameter, it instructs the compiler to inline the expression at the call site. If the expression is substantial, this creates considerable work for the JIT compiler.<p>Requesting inlining at the compiler level (as opposed to letting the JIT handle it) is risky unless you can guarantee that a later compiler phase will simplify the inlined code.<p>There&#x27;s an important behavioral difference between Scala 2 and 3: in 2, @inline was merely a suggestion to the compiler, whereas in 3, the compiler unconditionally applies the inline keyword. Consequently, directly replacing @inline with inline when migrating from 2 to 3 is a mistake.
    • AdieuToLogic6 hours ago
      &gt; There&#x27;s an important behavioral difference between Scala 2 and 3: in 2, @inline was merely a suggestion to the compiler, whereas in 3, the compiler unconditionally applies the inline keyword. Consequently, directly replacing @inline with inline when migrating from 2 to 3 is a mistake.<p>This reminds me of a similar lesson C&#x2F;C++ compilers had to learn with the &quot;register&quot; keyword. Early versions treated the keyword as a mandate. As compiler optimizers became more refined, &quot;register&quot; was first a recommendation and then ultimately ignored.<p>The C++ inline keyword is treated similarly as well, with different metrics used of course.<p>EDIT:<p>Corrected reference to early C&#x2F;C++ keyword from &quot;auto&quot; to &quot;register&quot;.
      • cpeterso6 hours ago
        Do you mean the ‘register’ keyword?
        • AdieuToLogic5 hours ago
          My root-cause analysis:<p>I was visualizing Scala method definitions and associated the language&#x27;s type inference with keyword use, thus bringing C++&#x27;s &quot;auto&quot; keyword to mind when the long-since deprecated &quot;register&quot; keyword was the correct subject.<p>It would appear LLM&#x27;s are not the only entities which can &quot;hallucinate&quot; a response. :-D
        • AdieuToLogic5 hours ago
          &gt; Do you mean the ‘register’ keyword?<p>Yes I did, my bad.
    • dtech15 hours ago
      Kotlin <i>heavily</i> uses the inline keyword basically everywhere, to get rid of lamdba overhead for functions like map. Basically every stdlib and 3rd part library function that takes a lamdba is inlined.<p>In general it&#x27;s a performance benefit and I never heard of performance problems like this. I wonder if combined with Scala&#x27;s infamous macro system and libraries like quicklens it can generate huge expressions which create this problem.
      • pjmlp12 hours ago
        This is one example why being a guest language isn&#x27;t optimal.<p>They should have made use of JVM bytecodes that allow to optimize lambdas away and make JIT aware of them, via invokedynamic and MethodHandle optimizations.<p>Naturally they cannot rely on them being there, because Kotlin also needs to target ART, JS runtimes, WebAssembly and its own native version.
        • dtech12 hours ago
          Kotlin existed before Java 7 and kept support JVM 1.6 for a long time (mainly because of Android)<p>Even then, they benchmarked it, and inlining was still faster* than invokedynamic and friends, so they aren&#x27;t changing it now JVM 1.8+ is a requirement.<p>* at the expense of expanded bytecode size
          • pjmlp12 hours ago
            Java 7 to Java 25 is a world apart, and then on which JVM?<p>Naturally it is a requirement, JetBrains and Google only care about the JVM as means to launch their Kotlin platform, pity that they aren&#x27;t into making a KVM to show Kotlin greatness.<p>If it feels salty, I would have appreciated if Android team was honest about Java vs Kotlin, but they weren&#x27;t and still aren&#x27;t.<p>If they were, both languages would be supported and compete on merit, instead of sniffling one to push their own horse.<p>Even on their Podcast they reveal complete lack of knowledge where Java stands.
            • hunterpayne11 hours ago
              Maybe the JVM team should listen to the market then and disable the jigsaw encapsulation that keeps devs on 1.8. Forcing a questionable security framework on everyone is why 1.8 is still used. Again, this is a problem because the PMs (and some devs) refuse to listen to what the market wants. So they are stuck keeping a 20 year old version of the code working. Serves them right to have to do this. It is their penance for being too arrogant to listen to the market.<p>PS Yes, I know, there is some weird way to disable it. Somehow that way changes every version and is about as non-intuitive as possible. And trying to actually support the encapsulation is by a wide margin more work than it is worth.
              • clhodapp9 hours ago
                I&#x27;m pretty sure that the majority of shops that aren&#x27;t worrying about Android have moved on from Java 8. The JVM team only keep Java 8 working for customers paying them lots of money for extended support contracts. And that&#x27;s only because they have this long-term extended support system for all LTS JVM releases (they are also still supporting 11 in a similar manner).<p>On the other hand, Android doesn&#x27;t even support Java 8. It supports the long-dead Java 7 plus a subset of Java 8 features. Android essentially froze their core application runtime in amber over ten years ago and have just been adding layer upon layer of compiler-level sugar ever since. The effect is an increasing loss of the benefit of being on the Java platform, in terms of code sharing.
                • geokon4 hours ago
                  Didn&#x27;t Google win the lawsuit with Oracle?<p>I never understood why they do not track the OpenJDK versions. I don&#x27;t work on Android apps.. but it seems mildly insane to basically have a weird almost-Java where you aren&#x27;t even sure if you can use a given Java lib.<p>Ex: I just took a look at a dependency I&#x27;m using<p><a href="https:&#x2F;&#x2F;github.com&#x2F;locationtech&#x2F;spatial4j" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;locationtech&#x2F;spatial4j</a><p>Can it be used on Android..? I have no idea<p>From what I understand it&#x27;s a weird stack now where nobody is actually writing Java for Android.<p>I&#x27;m still waiting for the day I can write a Clojure app for my phone..<p>(and not a Dart chat app.. but something actually performant that uses the hardware to the full extent)
                  • refulgentis3 hours ago
                    &gt; I never understood why they do not track the OpenJDK versions. I don&#x27;t work on Android apps.. but it seems mildly insane to basically have a weird almost-Java where you aren&#x27;t even sure if you can use a given Java lib.<p>NIH syndrome<p>&gt; (and not a Dart chat app.. but something actually performant that uses the hardware to the full extent)<p>I used to work on Android, quit two years ago and have used Flutter since, it&#x27;s a breath of fresh air. It does use the hardware to the full extent, imo it&#x27;s significantly more performant: it does an end-around all the ossified Android nonsense.
                    • geokon2 hours ago
                      Hmm, so if you wanted to make an AR app, or some audio processing app, would you do that in Flutter? All the projects I have in mind involve using the camera&#x2F;microphone&#x2F;gps etc. Looking at Dart sample projects it just seemed to be quite different from what they&#x27;re aiming at
              • pjmlp10 hours ago
                I have not done a Java 8 project in years, other than Android because the reasons we all know.<p>Maybe Google could finally support latest Java versions on Android, instead of begrudgingly update when Kotlin lags behind Maven Central most used versions.<p>Which by the way is a Java 17 subset, not Java 8, when supporting Android versions below Android 12 isn&#x27;t required.
              • imtringued11 hours ago
                What you&#x27;re asking for is essentially commercial support from Oracle.
                • hunterpayne10 hours ago
                  Nope, what I am asking for is disabling an on by default feature that maybe 1% of the market wants and&#x2F;or needs and creates significant pain for the other 99%. By the time strong encapsulation meets an attacker, the battle is already lost most of the time.
                  • Pet_Ant6 hours ago
                    That feature is necessary to enable future enhancements. It’s an important stepping stone. Just update your code. I’m doing it on 20 year old legacy billion dollar code base. It can be done.
                  • jolux3 hours ago
                    It&#x27;s not just for security, it&#x27;s also for maintainability. Frankly being able to reflect across package boundaries has always seemed like a misfeature for maintainability to me. The code you have that is broken by Java 9 was already badly behaved, the JVM was just lenient about it.
        • gavinray12 hours ago
          There are Kotlin compiler flags to default to &quot;indy&quot; optimization, and which may be enabled by default for some time now?<p>Also not all Kotlin inlines are lambdas or even include method calls
      • gavinray13 hours ago
        The killer is specifically the inlining of macros -- which Kotlin lacks.<p>And not all macros, but just the ones which expand to massive expressions<p>Think template expressions in C++ or proc macros in Rust
  • hunterpayne11 hours ago
    The problem with Scala 3 is that nobody asked for it. The problem with Scala 2 is that the type inference part of the compiler is still broken. Nobody worked on that. Instead they changed the language in ways that don&#x27;t address complaints. Completely ignore the market and deliver a product nobody wants. That&#x27;s what happened here.<p>PS Perhaps they should make an actual unit test suite for their compiler. Instead they have a couple of dozen tests and have to guess if their compiler PR will break things.
    • thefaux11 hours ago
      It&#x27;s sad but I generally agree. Scala was in my view pretty well positioned for an up and coming language ~2010-15. Not only did the scala 3 rewrite fail to address many of the most common pain points -- compile times and tooling immediately come to mind -- the rewrite took many years and completely stalled the momentum of the project. I have to wonder at this point who is actually starting a new project in scala in 2025.<p>It&#x27;s really a shame because in many ways I do think it is a better language than anything else that is widely used in industry but it seems the world has moved on.
      • theLiminator12 minutes ago
        &gt; It&#x27;s really a shame because in many ways I do think it is a better language than anything else that is widely used in industry but it seems the world has moved on.<p>I&#x27;m really hoping that <a href="https:&#x2F;&#x2F;flix.dev&#x2F;" rel="nofollow">https:&#x2F;&#x2F;flix.dev&#x2F;</a> will learn from the mistakes of Scala. I t looks like a pretty nice spiritual successor to Scala.
      • zahlman9 hours ago
        &gt;It&#x27;s sad but I generally agree. Scala was in my view pretty well positioned for an up and coming language ~2010-15<p>I used Scala for a bit around that period. My main recollection of it is getting Java compiler errors because Scala constructs were being implemented with deeply nested inner classes and the generated symbol names were too long.
    • lispisok10 hours ago
      I tried getting into Scala several times and kept going back to Clojure. Unless you are into type system minigames Clojure has many of the things Scala advertises but without the dumptruck of Scala overhead and complexity. Another commenter briefly touched on this but it&#x27;s a language made by academics for academics to play with language design. It was a little weird it blew up in industry for a while.
      • acjohnson559 hours ago
        &gt; it&#x27;s a language made by academics for academics to play with language design. It was a little weird it blew up in industry for a while.<p>Yep. They have always been pretty honest about this.<p>I think that it blew up in industry because it really was ahead of its time. Type systems were pretty uncool before Scala. It proved that you could get OO and FP in a single type system.<p>Actually, a big part of reason for doing Scala 3 was rebasing the language on a more rigorous basis for unifying OO and FP. They felt that for all their other big ideas, it was time to rethink the fundamentals.
        • refulgentis9 hours ago
          &gt; Type systems were pretty uncool before Scala<p>I’m not up on programming language engineering as much as I should be at 37, could you elaborate a bit here? (To my untrained ear, it sounds like you’re saying Scala was one of the first languages that helped types break through? And I’m thinking that means, like, have int x = 42; or Foo y = new Foo()”
          • hunterpayne8 hours ago
            Not types, type-safety. Things like covariant and contravariant type declarations, implicit types (variables looked up by type instead of by label), and other things that you need to make a type safe system&#x2F;service&#x2F;application. The problem is that that feature of a language is massively oversold. Its nice but to pretend it prevents bugs or is even a great design goal is questionable and not backed up by research (as they claim).
            • dionian5 hours ago
              But it’s still a way more powerful and expressive type system than Java. So using it in a JVM ecosystem is a perfect fit.
      • dionian5 hours ago
        The simplicity of closure is certainly a main part of its appeal. I’ve never done OOP in it, but I don’t think I want to. I have a lot of respect for it though.
    • monksy5 hours ago
      It was absolutely amazing how stubborn and ridiculous the whole bracket-less syntax change was handled. It was basically a dictatorial decision that they pretended to be a community decision. It was just pushed and tons of people voiced their disapproval. In the end it was &quot;so bad so sad you can always reenable brackets&quot;.<p>They did it to try to appeal to Pythonists.. turns out that wasn&#x27;t why Pythonists didn&#x27;t use scala in the first place.
      • dionian5 hours ago
        I think it’s nice to be able to use it. But like pretty much everything in scala, it’s a huge smorgasbord of things from which you can choose. I personally don’t use that syntax, but it’s cool that I can and sometimes I do just for fun.
    • voidfunc11 hours ago
      Scala has deep roots in the Ivory Towers of Academia, its not shocking they think they know better than their users what the problems with the language are and didn&#x27;t do any kind of real product management to figure out the actual problems before embarking on a rebuild.
    • ergocoder6 hours ago
      You capture the root issue quite well.<p>Now every tool has to adapt to Scala 3. And you guess it? It will take time. Even IntelliJ still doesn&#x27;t correctly highlight syntax on some parts that also exist in Scala 2. And this has been years after Scala 3 was launched. It&#x27;s mind-boggling.<p>They could have improved upon Scala 2 and incrementally add more capabilities. It&#x27;s obvious they don&#x27;t care about Scala&#x27;s industry success. They care mostly about the academic success. Nothing wrong with that, but that should be made very clear.<p>In Scala, they have a huge debate with zealots arguing against, for example, early return; they would describe how bad it will be blah blah blah e.g. <a href="https:&#x2F;&#x2F;tpolecat.github.io&#x2F;2014&#x2F;05&#x2F;09&#x2F;return.html" rel="nofollow">https:&#x2F;&#x2F;tpolecat.github.io&#x2F;2014&#x2F;05&#x2F;09&#x2F;return.html</a>, meanwhile Kotlin supports early return with absolutely no issue.
    • oelang11 hours ago
      And I wish you read the article, you&#x27;re comments are completely off topic.
    • lmm8 hours ago
      &gt; The problem with Scala 2 is that the type inference part of the compiler is still broken. Nobody worked on that. Instead they changed the language in ways that don&#x27;t address complaints.<p>Huh? Type inference is much more consistent and well-specified in 3. In 2 it was ad-hoc so and impossible to fix anything for one codebase without breaking another. There are plenty of legitimate complaints to be had about Scala 3, but this is absolutely not one of them.
  • dmix16 hours ago
    &gt; After upgrading the library, performance and CPU characteristics on Scala 3 became indistinguishable from Scala 2.13.<p>We had a similar experience moving Ruby 2-&gt;3, which has a ton of performance improvements. It was in fact faster in many ways but we had issues with RAM spiking in production where it didn&#x27;t in the past. It turned out simply upgrading a couple old dependencies (gems) to latest versions fixed most of the issues as people spotted similar issues as OP.<p>It&#x27;s never good enough just to get it running with old code&#x2F;dependencies, always lots of small things that can turn into bigger issues. You&#x27;ll always be upgrading the system, not just the language.
  • jiehong14 hours ago
    &gt; After upgrading the library, performance and CPU characteristics on Scala 3 became indistinguishable from Scala 2.13.<p>Checking the bug mentioned, it was fixed in 2022.<p>So, I’m wondering how one would upgrade to scala 3, while keeping old version of libraries?<p>Keeping updated libraries is a good practice (even mandatory if you get audits like PCI-DSS).<p>That part puzzled me more than the rest.
    • tasuki11 hours ago
      &gt; Keeping updated libraries is a good practice<p>First, the &quot;good practice&quot; argument is just an attempt to shut down the discussion. God wanted it so.<p>Second, I rather keep my dependencies outdated. New features, new bugs. Why update, unless there&#x27;s a specific reason to do so? By upgrading, you&#x27;re opening yourself up to:<p>- Accidental new bugs that didn&#x27;t have the time to be spotted yet.<p>- Subtly different runtime characteristics (see the original post).<p>- Maintainer going rogue or the dependency getting hijacked and introducing security issues, unless you audit the full code whenever upgrading (which you don&#x27;t).
    • mystifyingpoi13 hours ago
      I&#x27;m confused as well, because he wrote<p>&gt; I did it as usual - updating dependencies<p>but later<p>&gt; After upgrading the library, performance and CPU characteristics on Scala 3 became indistinguishable from Scala 2.13.<p>So... he didn&#x27;t upgrade everything at first? Which IMO makes sense, generally you&#x27;d want to upgrade as little as possible with small steps. He just got unlucky.
      • gavinray13 hours ago
        It would have been a transitive dependency based on the comments about the library being &quot;transparent&quot; and the author unaware it was even used.<p>Pinning specific versions of transitive deps is fairly common in large JVM projects due to either security reasons or ABI compatibility or bugs
    • fn-mote13 hours ago
      &gt; Checking the bug mentioned, it was fixed in 2022.<p>I was considerably less impressed by the reporting when I finally found out the culprit.<p>Sure it was “Scala 3” … but not really.<p>It was an interaction of factors and I don’t think it would take away from the story to acknowledge that up front.
    • lmm8 hours ago
      &gt; So, I’m wondering how one would upgrade to scala 3, while keeping old version of libraries?<p>The normal way.<p>&gt; Keeping updated libraries is a good practice<p>So is changing one thing at a time, especially when it&#x27;s a major change like a language version upgrade.
    • gavinray13 hours ago
      If your Maven&#x2F;Gradle&#x2F;SBT build specifies a version constraint for a third party lib, updating your Scala or Kotlin version doesn&#x27;t affect this<p>(For scala-specific libs, there is a bit more nuance, because lib versions contain scala version + lib version, e.g. foolib:2.12_1.0.2 where 2.12 = scala version)
  • spockz17 hours ago
    For me the main takeaway of this is that you want to have automated performance tests in place combined with insights into flamegraphs by default. And especially for these kind of major language upgrade changes.
    • malkia11 hours ago
      Benchmarking requires a bit of different setup than the rest of the testing, especially if you want down to the ms timings.<p>We have continous benchmarking of one of our tools, it&#x27;s written in C++, and to get &quot;same&quot; results everytime we launch it on the same machine. This is far from ideal, but otherwise there be either noisy neighbours, pesky host (if it&#x27;s vm), etc. etc.<p>One idea that we thought was what if we can run the same test on the same machine several times, and check older&#x2F;newer code (or ideally through switches), and this could work for some codepaths, but not for really continous checkins.<p>Just wondering what folks do. I can assume what, but there is always something hidden, not well known.
      • spockz11 hours ago
        I agree for measuring latency differences you want similar setups. However, by running two versions of the app concurrently on the same machine they both get impacted more or less the same by noisy neighbours. Moreover, by inspecting the flamegraph you can, manually, see these large shifts of time allocation quickly. For automatic comparison you can of course use the raw data.<p>In addition you can look at total cpu seconds used, memory allocation on kernel level, and specifically for the jvm at the GC metrics and allocation rate. If these numbers change significantly then you know you need to have a look.<p>We do run this benchmark comparison in most nightly builds and find regressions this way.
        • malkia7 hours ago
          Good points there - Thanks @spockz!
    • esafak16 hours ago
      What are folks using for perf testing on JVM these days?
      • cogman1015 hours ago
        For production systems I use flight recordings (jfrs). To analyze I use java mission control.<p>For OOME problems I use a heap dump and eclipse memory analysis tool.<p>For microbenchmarks, I use JMH. But I tend to try and avoid doing those.
      • spockz11 hours ago
        I use jmh for micro benchmarks on any code we know is sensitive and to highlight performance differences between different implementations. (Usually keep them around but not run on CI as an archive of what we tried.)<p>Then we do benchmarking of the whole Java app in the container running async-profiler into pyroscope. We created a test harness for this that spins up and mocks any dependencies based on api subscription data and contracts and simulates performance.<p>This whole mechanism is generalised and only requires teams that create individual apps to work with contract driven testing for the test harness to function. During and after a benchmark we also verify whether other non functionals still work as required, i.e. whether tracing is still linked to the right requests etc. This works for almost any language that we use.
      • noelwelsh16 hours ago
        jmh is what I&#x27;ve always used for small benchmarks.
      • gavinray13 hours ago
        async-profiler
  • derriz16 hours ago
    I was involved in a Scala point version migration (2.x) migration a few years ago. I remember it being painful. Although I recall most of the pain was around having lots of dependencies and waiting for libraries to become available.<p>At the time Scala was on upswing because it had Spark as its killer app. It would have been a good time for the Scala maintainers to switch modes - from using Scala as a testbed for interesting programming-language theories and extensions to providing a usable platform as a general commercially usable programming language.<p>It missed the boat I feel. The window has passed (Spark moved to Python and Kotlin took over as the &quot;modern&quot; JVM language) and Scala is back to being an academic curiosity. But maybe the language curators never saw expanding mainstream usage as a goal.
    • hylaride16 hours ago
      Outside of Android work, has Kotlin really taken over? My understanding is that Java added a lot of functional programming and that took a lot of wind out of Scala&#x27;s sails (though Scala&#x27;s poor tooling certainly never helped anything).
      • mystifyingpoi13 hours ago
        &gt; My understanding is that Java added a lot of functional programming<p>This is true, but needs more context. Java 8 added Stream API, which (at this time) was a fantastic breath of fresh air. However, the whole thing felt overengineered at many points, aka - it made complex things possible (collector chaining is admittedly cool, parallel streams are useful for quick-and-dirty data processing), but simple everyday things cumbersome. I cannot emphasize how tiring it was to have to write this useless bolierplate<p><pre><code> customers.stream().map(c -&gt; c.getName()).collect(Collectors.joining(&quot;, &quot;)) </code></pre> for 1000th time, knowing that<p><pre><code> customers.map(c -&gt; c.getName()).join(&quot;, &quot;) </code></pre> is what users need 99.99999% of the time.
      • dtech14 hours ago
        Sort of true, but I often hear this take from Java programmers and it feels like &quot;Blub&quot; [1]&#x2F;Stockholm syndrome to me.<p>Personally, I&#x27;m extremely glad to not have had to write .toStream().map(...).collect(Collectors.list()) or whatever in years for what could be a map. Similar with async code and exception handling.<p>For me one of the main advantages of Kotlin is that is decreases verbosity so much that the interesting business logic is actually much easier to follow. Even if you disregard all the things it has Java doesn&#x27;t the syntax is just so much better.<p>[1] <a href="https:&#x2F;&#x2F;paulgraham.com&#x2F;avg.html" rel="nofollow">https:&#x2F;&#x2F;paulgraham.com&#x2F;avg.html</a>
        • wrathofmonads9 hours ago
          Java 16+<p><pre><code> stream.map(...).toList() </code></pre> <a href="https:&#x2F;&#x2F;bugs.openjdk.org&#x2F;browse&#x2F;JDK-8180352" rel="nofollow">https:&#x2F;&#x2F;bugs.openjdk.org&#x2F;browse&#x2F;JDK-8180352</a>
          • lmm4 hours ago
            So only 2 bullshit boilerplate calls instead of 3? I guess that&#x27;s progress.
      • aarroyoc15 hours ago
        At least where I work, writing new Java code is discouraged and you should instead use Kotlin for backend services. Spring Boot which is the framework we use, supports Kotlin just fine, at the same level as Java. And if you use Jetbrains tools, Kotlin tooling is also pretty good (outside Jetbrains I will admit it is worse than Java). Now, even in new Java projects you can still be using Kotlin because it is the default language for Gradle (previously it was Groovy).
      • gavinray13 hours ago
        My org had to write a pivotal backend service on the JVM, due to JDBC having the largest number of data source adapters.<p>The choice was Kotlin. Scala is too &quot;powerful&quot; and can be written in a style that is difficult for others, and Java too verbose.<p>Kotlin is instantly familiar to modern TypeScript&#x2F;Swift&#x2F;Rust etc devs.<p>The only negative in my mind has been IntelliJ being the only decent IDE, but even this has changed recently with Jetbrains releasing `kotlin-lsp` for VS Code<p><a href="https:&#x2F;&#x2F;github.com&#x2F;Kotlin&#x2F;kotlin-lsp" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Kotlin&#x2F;kotlin-lsp</a>
      • kelnos8 hours ago
        Java did indeed add more FP to the language, but Java&#x27;s type system is still fairly primitive compared to Scala&#x27;s.
      • esafak15 hours ago
        Java&#x27;s new features are always going to be on paper. The ecosystem, with all its legacy code, is always going to be a decade behind. And if you are starting a new project, why would you pick Java over Kotlin?
        • frje140014 hours ago
          &gt; And if you are starting a new project, why would you pick Java over Kotlin?<p>Because in 5-10 years you&#x27;ll have a Java project that people can still maintain as if it&#x27;s any other Java project. If you pick Kotlin, that might at that point no longer be a popular language in whatever niche you are in. What used to be the cool Kotlin project is now seen as a burden. See: Groovy, Clojure, Scala. Of course, I recognize that not all projects work on these kinds of timelines, but many do, including most things that I work on.
          • fulafel3 hours ago
            I don&#x27;t think Clojure belongs there. It was never as big as Kotlin, but it&#x27;s got great community, longevity and takes backwards compatibility very seriously, and 10 year old Clojure projects seem to be aging at least as well as 10 year old Java projects.
          • wrathofmonads11 hours ago
            Clojure has never been a popular language, nor has it aimed to be mainstream. That is the Lisp curse. It has never positioned itself as a &quot;better Java&quot;. It shines in applications where immutable, consistent, and queryable data is crucial, and it has found another niche in UIs through ClojureScript.
        • pjmlp12 hours ago
          Because the Java Virtual Machine is designed for Java, and that is what all vendors care about.<p>Kotlin is Google&#x27;s C#, with Android being Google&#x27;s .NET, after Google being sued by coming up with Google&#x27;s J++, Android Java dialect.<p>Since Google wasn&#x27;t able to come up with a replacement themselves, Fuchsia&#x2F;Dart lost the internal politics, they adopted the language of the JetBrains, thanks to internal JetBrains advocates.
          • bhawks9 hours ago
            | Android being Google&#x27;s .NET, after Google being sued by coming up with Google&#x27;s J++, Android Java dialect.<p>The Oracle v Google was specifically over copyright infringement concerning the Java APIs used in Android&#x27;s original implementation (Dalvik&#x2F;ART), not about creating a &quot;J++&quot; dialect.<p>Android never ran a JVM on mobile because it cannot be optimized for resource constrained devices a solution like DalvikVM was necessary. If you want to level critiques about creating fragmented dialects of Java I would recommend starting with J2ME. The only nice thing I can say about J2ME is at least it died.<p>The Android ecosystem was far too mature for Fuchsia&#x2F;Dart to be successful without a very compelling interop story that was never produced.<p>As a technology Kotlin met Android&#x27;s platform and community needs. Advocacy and politicking played a minimal, if any, role.
            • pjmlp2 hours ago
              Lies sold by Google.<p>Nokia and Sony Ericsson were using J2ME perfectly fine, as did Blackberry. I should know ad ex-Nokian.<p>Kotlin met nothing, it was pushed by Kotlin heads working on Android Studio, telling lies comparing Kotlin to Java 7, instead of Java was already offering at the time.<p>To this day they never do Kotlin vs Java samples, where modern Java is used, rather the version that bests fits their purpose to sell why Kotlin.<p>Fragmentation, what a joke, the fragmentation got so bad in Android, that JetPack libraries, previously Android X, exist to work around the fragmentation and lack of OEM updates.<p>Gosling said it better, regarding Google&#x27;s &quot;good&quot; intentions<p><a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZYw3X4RZv6Y&amp;feature=youtu.be&amp;t=57m42s" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=ZYw3X4RZv6Y&amp;feature=youtu.be...</a>
        • hylaride15 hours ago
          That&#x27;s kind of what I&#x27;m asking. I did have a former co-worker write a micro service in Kotlin around 2018. He said that as nice as the language is, the ecosystem was (at the time, not sure how it is today) so utterly dominated by Android development, that he said he wouldn&#x27;t recommend using it again - half the time he was calling out Java anyways.
          • gavinray12 hours ago
            Kotlins &quot;ecosystem&quot; is all of Java, and then all of Kotlin.<p>Put another way: Java only has access to a subset of the ecosystem<p>Almost all of the backend libraries I use are Java libs. Some of them have additional Kotlin extension libs that add syntax sugar for more idiomatic code.
          • esafak15 hours ago
            I use kotlin and I do not feel oppressed by Android in any way. And I&#x27;d rather call Java libraries from Kotlin than Java. Many have Kotlin wrappers.
          • dtech15 hours ago
            That&#x27;s a weird take. Even if true, kotlin has perfect interop with calling Java libs so there&#x27;s not really a downside to keep using Java libs. There&#x27;s not that much demand for kotlin-specific libs outside multiplatform which includes Android.<p>For what it&#x27;s worth, Spring has first tier Kotlin support, I haven&#x27;t noticed this bias.
        • adrianN14 hours ago
          It’s a lot cheaper to hire for Java than for „modern“ languages.
          • blandflakes9 hours ago
            Have you ever heard the expression &quot;you get what you pay for?&quot;
    • wrathofmonads11 hours ago
      Kotlin hasn’t made much of an impact in server-side development on the JVM. I’m not sure where this perception comes from, but in my experience, it’s virtually nonexistent in the local job market.
      • izacus11 hours ago
        Why is your personal experience relevant to the wider market? How many companies and locations did you survey for that?
      • strobe9 hours ago
        another issue with kotlin, because it encourage Java ecosystem usage like Spring is not much differentiation that could drive adoption.
    • pjmlp12 hours ago
      Kotlin is an Android language, because Google says so, and they stiffle Java support on purpose (Java 17 LTS subset currently).<p>Outside Android, I don&#x27;t even care it exists.<p>If I remember correctly, latest InfoQ survey had it about 10% market share of JVM projects.
  • pjmlp16 hours ago
    The only issue I have with Scala 3 is Python envy, they should not have come up with a second syntax, and pushing it as the future.<p>If anything is slowly down Scala 3 is that, including the tooling ecosystem that needs to be updated to deal with it.
    • noelwelsh13 hours ago
      Everything is up to date with the new syntax as far as I&#x27;m aware. Also, the compiler and scalafmt can rewrite one to the other. A project can pick whatever style it wants and have CI reformat code to that style.
      • lmm8 hours ago
        &gt; Everything is up to date with the new syntax as far as I&#x27;m aware.<p>The Eclipse plugin isn&#x27;t, and none of the newer IDE integrations is reliable.
      • pjmlp13 hours ago
        When I checked a year ago, the IDE tooling still wasn&#x27;t quite there.
        • blandflakes6 hours ago
          I always find downvoting on stuff like this perplexing. It <i>still</i> isn&#x27;t there. I know that a lot of Scala people are doing metals and some kind of text editor experience, but if you&#x27;ve used something as powerful as Intellij, the Scala 3 experience is a serious downgrade, and it still is <i>today</i>, even though it&#x27;s better than it was a year ago.
        • spockz11 hours ago
          What I don’t get because there is LSP and BSP support. What else is needed to get support for scala 3 from an IDE? Obviously, Kotlin coming from Jetbrains will make it receive a lot more love and first class support.
          • pjmlp10 hours ago
            Parity with Scala 2 development experience, which was lacking a year ago.
    • ergocoder6 hours ago
      It&#x27;s on brand for Scala to have multiple ways of achieving the same thing.<p>Now we x2 by having the curly brace syntax and the indent syntax.
    • esafak15 hours ago
      You could also have compared it, more attractively, to Haskell.
      • pjmlp15 hours ago
        Except the reason behind the syntax change is the losing mindshare from Scala into Python, after its relevance in the big data wave that predated the current AI wave.<p>Nothing to do with Haskell, even if it is also white space significant.
    • gedy16 hours ago
      As a former Scala fan, wow you aren&#x27;t kidding, wth<p><pre><code> val month = i match case 1 =&gt; &quot;January&quot; case 2 =&gt; &quot;February&quot; &#x2F;&#x2F; more months here ... case 11 =&gt; &quot;November&quot; case 12 =&gt; &quot;December&quot; case _ =&gt; &quot;Invalid month&quot; &#x2F;&#x2F; the default, catch-all &#x2F;&#x2F; used for a side effect: i match case 1 | 3 | 5 | 7 | 9 =&gt; println(&quot;odd&quot;) case 2 | 4 | 6 | 8 | 10 =&gt; println(&quot;even&quot;) &#x2F;&#x2F; a function written with &#x27;match&#x27;: def isTrueInPerl(a: Matchable): Boolean = a match case false | 0 | &quot;&quot; =&gt; false case _ =&gt; true</code></pre>
      • jfim15 hours ago
        It&#x27;s been a while since I touched Scala but wasn&#x27;t that a thing in previous versions, minus the braces not being present?
        • weego13 hours ago
          Yes, that&#x27;s all just as it was, and in places braces were not required &#x2F; interchangeable so this is more of an optional compiler choice than a real change
      • malkia11 hours ago
        Sorry, I&#x27;m coming from C++-ish background - can anyone explain what&#x27;s going on :)
        • hocuspocus10 hours ago
          Scala 2&#x27;s syntax is mostly Java&#x2F;C-style with a few peculiarities.<p>Scala 3&#x27;s <i>optionally</i> allows indentation based, brace-less syntax. Much closer to the ML family or Python, depending on how you look at it. It does indeed look better, but brings its share of issues.[1] Worse, a lot of people in the community, whether they like it or not, think this was an unnecessary distraction on top of the challenges for the entire ecosystem (libraries, tooling, ...) after Scala 3.0 was released.<p>- [1] <a href="https:&#x2F;&#x2F;alexn.org&#x2F;blog&#x2F;2025&#x2F;10&#x2F;26&#x2F;scala-3-no-indent&#x2F;" rel="nofollow">https:&#x2F;&#x2F;alexn.org&#x2F;blog&#x2F;2025&#x2F;10&#x2F;26&#x2F;scala-3-no-indent&#x2F;</a>
          • gedy9 hours ago
            My personal take is this would be like JavaScript adopting an optional Coffeescript[1] syntax. It&#x27;s so different that it seems odd to make it an option vs a new language, etc.<p>[1] <a href="https:&#x2F;&#x2F;coffeescript.org&#x2F;#introduction" rel="nofollow">https:&#x2F;&#x2F;coffeescript.org&#x2F;#introduction</a>
      • bdangubic16 hours ago
        madness :)
        • a24j15 hours ago
          Can you eli5 the madness? And how that relates to python&#x2F;java?
  • xolve12 hours ago
    The bug reports linked on softwaremill and scala GitHub&#x27;s are precise and surprisingly small fixes! It does show Scala&#x27;s power in expressiveness.<p>Scala is a great language and I really prefer its typesafe and easy way to write powerful programs: <a href="https:&#x2F;&#x2F;www.lihaoyi.com&#x2F;post&#x2F;comlihaoyiScalaExecutablePseudocodethatsEasyBoringandFast.html" rel="nofollow">https:&#x2F;&#x2F;www.lihaoyi.com&#x2F;post&#x2F;comlihaoyiScalaExecutablePseudo...</a> Its a great Python replacement, especially if your project is not tied to ML libraries where Python is defacto, like JS on web.
  • Kwpolska15 hours ago
    The takeaway of upgrading your libraries when upgrading major language and framework versions applies beyond Scala. Especially when the libraries abuse magic language features (and far too many Scala libraries do) or otherwise integrate deep into the framework&#x2F;language.
  • groundzeros201512 hours ago
    I know this topic has been beat to death but this is another example of why high level language with super optimizing compiler has had less industry success.<p>If performance is a feature it needs to be written in the code. Otherwise it implicitly regresses when you reorder a symbol and you have no recourse to fix it, other than fiddling to see if it likes another pattern.
    • alberth12 hours ago
      To be fair, it’s misleading to group Scala (or any JVM language), with other “high-level languages.”<p>The JVM is extremely mature and performant, and JVM-based languages often run 5x (or more) than non-JVM high-level languages like Python or Ruby.
      • groundzeros201512 hours ago
        That doesn’t follow. Scala is a high level language and compiler above the JVM. The bug here is a high level one:<p>&gt; Turns out there was indeed a subtle bug making chained evaluations inefficient in Scala 3<p>I’m comparing with Haskell, Scheme, or even SQl which all promise to compile efficient code from high level descriptions.
        • blandflakes9 hours ago
          The bug in TFA is hardly a reason that Scala is not a success, though.
          • groundzeros20159 hours ago
            I didn’t say that. I’m highlighting a specific challenge of getting predictable performance over the lifetime of code.<p>Lower-level languages don’t have this same problem to the same extent. They have other problems Scala doesn’t have.
  • rr8088 hours ago
    I&#x27;m on Spark Scala 2 project and I hate it. Basically any good Scala dev would never want to work on our ETL projects, so we get second rate Python or Java devs like me who bastardize the language to get anything to work. Most of our new stuff is all pyspark, hopefully we can replace Scala asap.
  • ahZOTERESET6 hours ago
    <a href="https:&#x2F;&#x2F;www.experimental-history.com&#x2F;p&#x2F;bag-of-words-have-mercy-OF.MX.US" rel="nofollow">https:&#x2F;&#x2F;www.experimental-history.com&#x2F;p&#x2F;bag-of-words-have-mer...</a>
  • scotty7910 hours ago
    It&#x27;s quite impressive that you can swap out major version from under running application and have just one subtle issue.
  • esarbe12 hours ago
    Awesome language, nice to see others using it.<p>I can thoroughly recommend it. Once of the best languages out there in terms of expressive power.
  • atbpaca16 hours ago
    Thank you for sharing. Interesting insight on dep libraries.
  • munchler15 hours ago
    I’m not familiar with Scala’s macro system, but it seems like a big takeaway here is: Be careful with code that invokes the compiler (JIT) at runtime. That seems like it’s asking for trouble.
    • dtech14 hours ago
      Macro&#x27;s are compile time, there is no runtime codegen.<p>The problem was overly-frequent inlining generating enormous expressions, causing a lot JIT phase and slow execution.
      • gavinray11 hours ago
        That&#x27;s not true, Spark&#x27;s entire query engine relies on use of runtime codegen via macros&#x2F;quasi quotes<p>Look up the architecture of Catalyst + Tungsten<p><a href="https:&#x2F;&#x2F;www.databricks.com&#x2F;glossary&#x2F;catalyst-optimizer" rel="nofollow">https:&#x2F;&#x2F;www.databricks.com&#x2F;glossary&#x2F;catalyst-optimizer</a>
        • lmm8 hours ago
          Catalyst uses runtime codegen, sure, but the OP wasn&#x27;t using that.
      • munchler14 hours ago
        Thank you for the clarification. If I understand correctly, these large expressions are created at compile-time, but the impact isn&#x27;t felt until JIT occurs in the runtime environment. In that scenario, shouldn&#x27;t the JIT just run once at startup, though? I&#x27;m still not quite understanding how JIT can take so much time in a production environment.
        • hunterpayne11 hours ago
          Because the jit will let the unoptimized code run a few (hundred) times to take measurements to know what needs to be optimized and how it needs to be optimized. This is a good solution and makes hotspot very effective. The problem is that it happens randomly a few minutes&#x2F;seconds into the operation of the service. So you randomly have a big pause with the performance hit everytime you run the service. The upside is that this only happens once. But you have to plan for a big performance hit to requests which are unlucky enough to be called at the wrong time.
          • munchler8 hours ago
            Ah, that’s interesting. I wasn’t aware that JIT-ing will do that sort of performance analysis first. Thank you for the explanation.
          • pretzellogician10 hours ago
            And this can generally be avoided as well, by doing &quot;warmup&quot; when starting your service (effectively, mock some calls), but before accepting requests.
            • hunterpayne10 hours ago
              Of course, but then you have to actually do this. It is just another complexity to add. Also, I was answering a question about the hows and whys of the jit. I wasn&#x27;t saying it was impossible to work around.
  • phendrenad214 hours ago
    Controversial opinion: Scala should have gone into maintenance mode a decade ago. They got the language right at the beginning, and a decade of tinkering has just fatigued everyone and destroyed any momentum the language once had.
    • instig00714 hours ago
      &gt; and a decade of tinkering has just fatigued everyone and destroyed any momentum the language once had.<p>it&#x27;s hard to buy it, considering that many of those &quot;fatigued&quot; moved on Kotlin, led by their managers&#x27; bs talking points.
      • hunterpayne11 hours ago
        Many of the Scala projects got people fired. Something the Scala devs largely ignore. Plus Scala support is truly awful even by the low standards of an OpenSource project. Then there is the fact that the Scala specific libraries are largely dead.<p>Scala had&#x2F;has a lot of promise. But how the language is marketed&#x2F;managed&#x2F;maintained really let a lot of people down and caused a lot of saltiness about it. And that is before we talk about the church of type-safety.<p>Scala is a more powerful language than Kotlin. But which do you want? A language with decent support that all your devs can use, or a language with more power but terrible support and only your very best devs can really take advantage of. And I say this as someone writing a compiler in Scala right now. Scala has its uses. But trying to get physicists used to Python to use it isn&#x27;t one of them. Although that probably says more about the data science folks than Scala.<p>PS The GP is right, they should have focused on support and fixing the problems with the Scala compiler instead of changing the language. The original language spec is the best thing the Scala devs ever made.
        • hocuspocus10 hours ago
          Kotlin has become a pretty big and complex language on its own so I&#x27;m not sure this is a good counterexample.<p>The fundamental issue is that fixing Scala 2 warts warranted an entirely new compiler, TASTy, revamped macros... There was no way around most of the migration pains that we&#x27;ve witnessed. And at least the standard library got frozen for 6+ years.<p>However I agree that the syntax is a textbook case of trying to fix what ain&#x27;t broke. Scala 3&#x27;s syntax improvements should have stuck to the new given&#x2F;using keywords, quiet if&#x2F;then&#x2F;else, and no more overloaded underscore abuse.
          • blandflakes9 hours ago
            One impressive thing for us is that the changes to macros were hardly an issue. We&#x27;d been trending off macro-heavy libraries for a while, and our Scala 3 adoption has not really been harmed by the new macro system.
        • lmm8 hours ago
          &gt; Scala had&#x2F;has a lot of promise. But how the language is marketed&#x2F;managed&#x2F;maintained really let a lot of people down and caused a lot of saltiness about it. And that is before we talk about the church of type-safety.<p>On the contrary, there was nothing wrong with Scala&#x27;s marketing. What&#x27;s damaged it is a decade of FUD and outright lies from the people marketing Kotlin.