16 ms·
Evolving Scala
- linotype 2y agoI used Scala about a decade ago extensively and I’m still waiting for features I loved in it to be available in languages I have to use on a daily basis now. I miss it a lot.
- mpweiher 2y agoWhich features would those be?
- olivermuty 2y agoYou can code the whole program with only types and no code? Albeit that is possible in typescript these days too tho.
- tossandthrow 2y agoType systems expressive enough to write actual programs is widespread these days. Typescript's typesystem is even Turing complete. Regardless, it is not very practical to use a type checker as your runtime.
- linotype 2y agoDidn’t someone implement Doom in the Typescript type system?
- thinkharderdev 2y agoFor me, the killer features were the metaprogramming abilities (both type and macro based). Not so much because I used them directly but because they allowed library authors to create extremely expressive libraries.
- sideeffffect 2y ago* Immutable-first * Immutable/persistent collections in standard library * Machinery to "modify" immutable deeply nested case classes/sealed traits. You have the copy method, you have lens libraries. Very easy and comfortable to use. * Expression oriented. if/try/etc expression can be bound to a variable * less characters to write the same idea/program, while not losing readability * better tooling: Scalafmt is ubiquitously used, supported in IntelliJ and is very good. Scalafix (a linter which can also fix some issues automatically) is used a little bit less, but is also good. * build tools: while I don't like sbt, Mill is a so much better build tool than Maven or, even worse, Gradle. Then there is also scala-cli, which is not a build tool, but can work like it, if you have a simple, single-module project (i.e. no sub-projects/sub-modules).
- isjustintime 2y agoI liked Scala and was excited about learning and using it when it was picking up steam many years back. Unfortunately, it felt like there wasn't as much traction, and Scala has been siloed into some niche domains like Spark. It's a bummer since it's so nice to write with.
- manojlds 2y agoMy favourite was always Akka Streams. I loved working with it so much.
- margorczynski 2y ago+1, it's an amazing library. Actors is also great along with the rest of the Akka stack. Shame what LB did to it.
- drewhk 2y agoThis warms my heart in an otherwise bland day :)
- sideeffffect 2y agoI think it's actually used more to develop more or less ordinary backends. Or some tools/frameworks like Spark or Akka/Pekko. But you can (and people mostly do) use Spark from Python. And Akka/Pekko from Java (but I'm not sure how that is common). And the job market is there: https://functional.works-hub.com/jobs/?remote=true&tags=scala https://functional.works-hub.com/jobs/?remote=true&tags=scal... https://scalajobs.com/locations/remote/ https://scalajobs.com/locations/remote/ https://remoteok.com/remote-scala-jobs https://remoteok.com/remote-scala-jobs https://betterremotejobs.com/search?title=scala https://betterremotejobs.com/search?title=scala https://readytotouch.com/organizers/scala/vacancies?remote=1 https://readytotouch.com/organizers/scala/vacancies?remote=1 https://www.levels.fyi/jobs?searchText=Scala&workArrangements=remote https://www.levels.fyi/jobs?searchText=Scala&workArrangement... https://www.linkedin.com/mwlite/search/jobs?keyword=Scala&locationName=Remote https://www.linkedin.com/mwlite/search/jobs?keyword=Scala&lo... https://discord.com/channels/629491597070827530/629546253381795860 https://discord.com/channels/629491597070827530/629546253381... https://discord.com/channels/632277896739946517/840255868096086067 https://discord.com/channels/632277896739946517/840255868096...
- dmos62 2y agoScala was the first language I learned to program in. I technically started with Java and some Javascript, but I hardly knew what I was doing. Scala accelerated my learning via better expressiveness, better abstractions for iteration, and for asynchrony. It thought me a lot of valuable lessons, and I miss it. Sadly, I just don't find a spot for Scala in my toolkit these days: it's either Python for the numpy-et-al ecosystem, Clojurescript for frontend, Rust for portability, and something frontend-ish (probably just Javascript) for serverless backends. The long-lived JVM just doesn't have a place.
- sideeffffect 2y ago> Clojurescript for frontend, Rust for portability If Clojure and Rust work well for you, more power to you. But at least in theory, you could very well use just Scala for these purposes Scala can compile to JS https://www.scala-js.org/ https://www.scala-js.org/ if you target frontend. And if you want portability, you can compile a Scala program with GraalVM's native-image and statically link everything with musl libc https://www.graalvm.org/latest/reference-manual/native-image/guides/build-static-executables/#build-a-static-native-executable https://www.graalvm.org/latest/reference-manual/native-image... And if you want both frontend and portability everywhere, Scala will soon have a support for compiling to WASM (with WASI, etc) https://github.com/scala-wasm/scala-wasm/ https://github.com/scala-wasm/scala-wasm/ (to be integrated into Scala.js after developed)
- znpy 2y agoWhat about GraalVM licensing? According to https://www.graalvm.org/latest/introduction/#licensing-and-support https://www.graalvm.org/latest/introduction/#licensing-and-s... the community edition is free software (GPLv2 + classpath exception). But it isn't really clear what the differences are between the free software version and the proprietary version. There does not seem to be a page detailing the differences between the two (or at least I couldn't find it)
- sideeffffect 2y agoI think the proprietary variant of GraalVM comes with more optimizations in the compiler. But the AOT compilation (native-image) is available in the GPL community variant.
- yard2010 2y agoScala is hands down the most wonderful language I have ever worked with. Some simple paradigms it offers e.g. case matching has changed the way I see and write code in every other language.
- vvillena 2y agoMy favorite showcase of Scala to this day is pattern matching on regular expressions: val date = raw"(\d{4})-(\d{2})-(\d{2})".r "2004-01-20" match case date(year, month, day) => s"$year was a good year for PLs." This reads better than any equivalent Java or Kotlin code, while being much easier to maintain (e.g. matching against more than one regex).
- pantsforbirds 2y agoWould the kotlin equivalent just be: val dateRegex = Regex("""(\d{4})-(\d{2})-(\d{2})""") val (year, _, _) = dateRegex.matchEntire("2004-01-20")!!.destructured println("$year was a good year for PLs.") ?
- vvillena 2y agoThe Scala snippet works for all inputs, it's something you would see on a real codebase. It also scopes the regex captures within the match expression. The code also scales better for more complex cases where a string is tested against multiple regexes, or against specific captured values. I assume this Kotlin snippet would, at minimum, need to do null-checking on "matchEntire" before it finds its way to a production codebase.
- vaylian 2y agoWhat does the .r do at the end of the first line?
- vvillena 2y agoIt's a method call on a String that returns a Regex type, courtesy of the Scala standard library.
- nvarsj 2y agoIs Akka dead? TFA implies it in multiple places.
- Zambyte 2y agoI believe people mostly lost interest in it after it went proprietary (BSL). I know that's why I haven't touched it in years.
- crustycoder 2y agoI was half way through a project when the licensing change happened, I had to abandon Akka as a result. Fortunately my requirements for an Actor System are low-end, basically just message passing in a multithreaded single process, so I wrote my own simple Actor system library. Scala made that relatively easy.
- nikitaga 2y agoIt became less popular a long time ago as the hype of actors as a programming paradigm died down, and then eventually akka adopted non-OSS BSL license which made many users including us switch to Pekko (a community fork) which is still developed and maintained, but again, this branch of Scala evolution is quite past its prime. Scala offers more and arguably better libraries for working with concurrency now, and even cooler stuff is on the horizon with kyo / ox / caprese. But akka aka pekko is still perfectly usable.
- renegade-otter 2y agoI have been working on adding Pekko-based data pipeline into my side project, and it's an incredibly powerful system. The "bare" actors are rarely used. With streams, you can control parallelism, backpressure, add batching, retries, and so on. This is why this is so popular with systems ingesting massive amounts of data - log processing, IoT telemetry. Which libraries are you referring to that do the same? Just curious.
- nikitaga 2y ago
- cardanome 2y agoOther languages have caught up. Back in the days using Java was mind-numbing boring and boilerplate-galore. Scala offered vastly more productivity and fun. These days Java is... fine. Scala is still amazing but Java doesn't cause active pain anymore. It becomes harder to justify using a niche language. Scala will still live. It is an amazing language with a great combination of functional and OO programming. I just don't see a big breakthrough in popularity.
- sideeffffect 2y agoJava has certainly improved. Kudos to its stewards. But I think it still has many rough edges -- things that are awkward (or outright impossible) to do in Java and Scala is great. It doesn't have to be advanced features, like meta-programmig/macros. Here are some example that I think are not anything esoteric: * Just the mere fact that Scala has immutable/persistent collections improves how and what programs people write. * Scala also has good infrastructure to deal with "modifying" data model graphs in a persistent/immutable way. Think deeply nested case classes and sealed traits. You have the copy method, lens libraries, etc. Java does have records and sealed interfaces, but all the rest of the machinery to work with them is still missing. * To generalize the points above, Scala is immutable-first language, with all the positives that come with it. Java, still not so much (even though they are moving in that direction, e.g. `record`s). * Another weird thing in Java is how it deals with variance. In Scala, I find it easy to comprehend, in comparison. * Scala is expression oriented. Ifs, trys, etc -- all of them are expression. You can bound the result of these expressions to a variable. Not the case in Java, which makes it annoying to work with. You have to fist make the variable null or something and then make sure it gets assigned within of the body of the if/try/... Just a bad experience :( Than there is a matter of culture: * Java libraries like to return (and expect to be passed) a `null`. Scala culture embraces `Option` from its standard library. * While Java does have support for checked exceptions, which I think is a very good idea in theory, in practice its implementation is underwhelming (e.g. not possible to abstract over) and so libraries don't use it as much. With Scala you can return an `Either`. Or with new Scala 3, we may soon have powerful capability system to, among others, allow throwing "checked" exceptions. That's the Capture Checking https://docs.scala-lang.org/scala3/reference/experimental/cc.html https://docs.scala-lang.org/scala3/reference/experimental/cc... research. * This may be even more personal opinion that others, but I find Java libraries more difficult to use that Scala ones. With Scala, you just follow the types and you create and work with the objects that the library gives you in an intuitive way. With Java, the types don't help you as much. You have to read the documentation thoroughly, to make sure you're calling the right methods on the right objects, in the right order. Because the types don't help you, you can't be sure you doing it correctly, because every other way compiles too.
- ios-sux 2y agoi like scala and have used it as my primary language for the majority of my career. It is waning as other languages catch up, but to some extent perhaps having the self styled elitists move on to rust will mean that a more pragmatic and less dramatic user base is left behind and the intellectual one upmanship that has made scala toxic can find a home somewhere else. If I was starting out today I'd lean more towards python, typescript and go depending on use case. (I still think rust is over engineered, over used and over prescribed with very few people getting paid to write it) Anyway I am hoping it turns into somewhat of a COBOL where I can charge outlandish rates for fixing banks technical debt issues.
- minebreaker 2y agoMy main complaint is the poor IDE support. Shapeless breaks everything so casually. > We acknowledge that there is still work to do. The IntelliJ team is working hard on bringing the best support for Scala 3, and you can expect more improvements in the following months. Good to hear. I thought Jetbrains had completely abandoned Scala for Kotlin, so I'm glad they're still willing to support Scala.
- sideeffffect 2y ago> Shapeless breaks everything so casually. Thank goodness that Shapeless is not needed in Scala 3. The good parts have been integrated into the language itself and so it's reliable and faster. > Jetbrains had completely abandoned Scala Thankfully not at all. Gets regular releases, Scala 3 support is improving with each. They're also welcoming to PRs, if you have spotted a bug that needs fixing. (The codebase of the Scala plugin is in Scala, so that makes it easy for the community to contribute.)
- minebreaker 2y agoMy company still sticks to Scala2 so I may be misinformed, but I heard Scala3 tuples cannot completely replace Shapeless, like missing LabelledGeneric equivalent?
- nikitaga 2y agoScala has been very enjoyable and productive for me and the teams I've worked on. The first couple years of v2 -> v3 transition were a bit rough as the tooling and ecosystem was catching up, but now we happily use Scala 3 with no looking back. The language and ecosystem are evolving in a good direction, and I'm happy to play a small part in that with my open source libraries for Scala.js (which is the entire reason I got into Scala in the first place – so much simpler and safer than Typescript). Scala is perhaps not going to replace Java in every old enterprise, but in my personal experience working for startups, it's been an awesome force multiplier for small teams who need to productively pump out safe and ergonomic code. Finance, health systems, etc. And yet it's also ergonomic and pleasant enough for me to eagerly use it in my non-mission-critical personal projects as well.
- sgt 2y agoHow far is Java 24 from catching up to Scala though?
- haspok 2y agoJava will never "catch up" to Scala (for example, the type system / generics will not evolve in the foreseeable future). But once Valhalla lands, with some additional JEPs, Java will be very close to the core of what Scala offers. Where there are gaps, some of these can be filled via libraries (think immutables.org, or others providing persistent data structures). As a matter of fact, these days at most companies that I see the typical deployment model is "micro"services, which you can quickly develop via Spring Boot or the alternatives. No need for ultra complex code or asbtractions, Java does it just fine. And you have all the tooling you need for the enterprise world. I think Scala is an excellent language for teaching ML-style programming. I would still recommend it for that purpose. But there is no longer a killer app or need for Scala, that would convince most people to use it for new projects.
- pjmlp 2y agoJust like Scala by virtue of being a guest language on the JVM ecosystem, never will replace Java on the minds of JVM architects. Kotlin has an advantage here, because ART nowadays is effectly KVM from Google's point of view, where they grudgingly update Java support to keep up with Maven central. Scala has nothing like this, and the update on Python alongside native libraries, kind of stole its demand in big data, hence why this kind of scenarios is described on the article.
- adrianton3 2y ago> Heavy use of symbolic operators has thankfully fallen out of style. I assume this refers to operator overloading. I think `a + b - c` looks way more readable than `a.add(b).sub(c)` and I'm happy when a language lets me define my own operators for vectors/matrices but I also have a side-curiosity: do they ever have a good use case outside of a math context? I never heard anyone praise `<<` `>>` in C++ for ex.
- threeseed 2y agoIt's mainly about libraries implementing their own symbols e.g. ~>, ~>>, >->, λ Each of which was specific to that library and would confuse new developers beyond belief.
- nsonha 2y agoThe majority of code is not math. I prefer if languages have a math dsl, only in which, the math operators become available. I actually do like symbols as opposed to words (+ instead of append, : instead of as, < instead of extends, -> instead of function etc). They just need to have stable meaning, which conflicts with operator overloading/math.
- openplatypus 2y agoGreat post. There is no need to hide the fact that Scala is not the most popular language or that it ever will be. And Kudos to VirtusLabs for maintenance. Huge Kudos to Daniel for his courses. If you think Scala is difficult, check his course, these will change your mind. When building Wide Angle Analytics backend I chose Scala. Sometimes I miss the convenience of Spring Boot of having all integrations at the fingertips. But then I implement same thing in Scala and it is much leaner, boils down to couple of functions and it just fits nicely. My only personal pet peeve with Scala is painful upgrade path between libraries (Cats 2 -> Cats 3). Oh well.
- bionsystem 2y ago> Huge Kudos to Daniel for his courses. If you think Scala is difficult, check his course, these will change your mind. Daniel Ciocirlan I guess ?
- epolanski 2y ago> Another common request is to “stop implementing features”. Yes, it's a very common one shared by virtually all Scala 3 developers. Stop. At least for a couple of years. Tooling and the community just can't keep up and the language is very good already that the focus should be on the ecosystem and not language. But Scala devs are beyond deaf and that's what you get when a programming language is an ongoing research project on which many students and professors depend. It's not enough to say "if we stop developing new features the language will die" when there's 0 evidence by it and a huge fatigue towards the relentless development coming from most of the community.
- btreecat 2y agoThe tooling is IMO one of the leading causes of why the language has had a collapse in developer mind-share. If we want to say it really doesn't matter what language we choose, because any solution can be cooked up regardless, it absolutely matters then what the tools around that language bring to the table.
- bishabosha 2y agoWe have to be more specific about this “tooling” - what are you missing
- dmos62 2y agoNot sure why this is being downvoted. It's hard to do something actionable based on abstract critique.
- openplatypus 2y ago> Yes, it's a very common one shared by virtually all Scala 3 developers. Stop. At least for a couple of years. Please avoid generalisation. Not "all".
- epolanski 2y agoVirtually.
- margorczynski 2y agoScala is an amazing language that I've been using professionally for a decade. But it has three major problems: 1) The language is too unstable - something that might seems as a great boon is actually a big problem if you want to use the language for greater periods of time. 2) The tooling around it is not the best - problem with syntax support in IDEs, sbt is still a mess. Compared to modern offerings like Rust or Go it doesn't look that great. 3) Competition is quickly catching up - this isn't 2010-2015, Scala's competitors have been evolving quickly and picking up a lot of FP features (pattern matching HOFs, etc.) that made it stand out but at the same time offering a much bigger developer base, more mature frameworks, etc. A great example of this is modern Java but also Kotlin. Scala is still great but the gap isn't as big as it was a decade ago when Scala's popularity peaked. And of course it is still hard to find and recruit competent people, especially if you go FP-heavy using Cats/ZIO and not Java+ style. Guess that's why we see less and less new projects written in it (and most of those probably are Spark) and in many companies it's becoming a legacy language waiting for a rewrite to e.g. Java. "Scala will continue to evolve until morale improves"
- deleted 2y ago[deleted]
- sideeffffect 2y ago> 1) The language is too unstable Thankfully not anymore. They got their act together and have been maintaining compatibility since Scala 3.0.0 has been released in May 2021, which is almost 4 years and counting. https://github.com/scala/scala3/releases/tag/3.0.0 https://github.com/scala/scala3/releases/tag/3.0.0 Scala 3.x is to remain compatible for the whole 3.x series (think of semantic versioning). There's no Scala 4 (breaking with Scala 3) in sight. Also, Scala 3 and Scala 2.13 JARs are also compatible with each other, which helped with the transition. > 2) The tooling around it is not the best sbt may not be good. But Mill is much better than either Maven or Gradle. Especially Gradle. Bleep is also promising. Scalafmt is widely used and liked. Scalafix -- the linter/fixer -- is used a bit less, but still of a good quality.
- frde_me 2y ago
- GardenLetter27 2y agoCompile times are crazy, even worse than Rust in my experience.
- brodo 2y agoRust compile times are not as bad as they used to be.
- jghn 2y agoNeither are Scala's
- pkolaczk 2y agoAny links to benchmarks? Rust publishes their performance data: https://perf.rust-lang.org/dashboard.html https://perf.rust-lang.org/dashboard.html Where do I find similar thing for scala?
- sideeffffect 2y agohttps://dotty-bench.epfl.ch/ https://dotty-bench.epfl.ch/
- pkolaczk 2y agoBut it doesn’t confirm improving the speed of the compiler at all. Looks like the trend is flat. This comment from Odersky also says that Dotty was not automatically faster than 2.12: https://news.ycombinator.com/item?id=16884317 https://news.ycombinator.com/item?id=16884317
- dionian 2y agoincremental compiler makes this mostly a non-issue
- sideeffffect 2y ago> Compile times are crazy This is also heavily influenced by the build too you use. Don't use sbt or Maven or Gradle. Use the good stuff. Use Mill. https://mill-build.org/mill/comparisons/why-mill.html#_performance https://mill-build.org/mill/comparisons/why-mill.html#_perfo... Or Bleep, if you're feeling more experimental https://bleep.build/ https://bleep.build/ .
- whoevercares 2y agoThere’s another reason for the decline of Scala - much less people are writing Spark code in Scala. At peak I think Spark accounted for a large portion of Scala’s growth
- dionian 2y agothis is a good thing for scala actually, a lot of people have said 'wow scala is horrible' and later i find out they were doing black magic spark codebases
- whoevercares 2y agoHmm very good point!
- dboreham 2y agoScala serves a useful purpose: if you are thinking of taking a job somewhere and it turns out they use Scala, and aren't migrating off it, then you know not to take that job.
- ryandvm 2y agoI wonder to what extent the use of Scala at an organization is a "red flag". No disrespect to the language. I've used it a couple times and if you're all in on FP then it's probably the way to go. But say you're interviewing for a job - what does it say about an organization if they've picked a somewhat obscure, academic tool to build their product? They are probably exceedingly clever, but are you in for long technical debates about arcane minutiae? Are they stubborn and uncompromising? Do they make impractical technical decisions?
- jghn 2y agoWhen did they choose it, and why? It was far from obscure 10 years ago.
- the_af 2y ago> I've used it a couple times and if you're all in on FP then it's probably the way to go. It's a hybrid paradigm language and back when I used it (v2), it was perfectly possible -- and common -- to write code without using more FP idioms than is now common in most languages, Javascript, Python and Java included. A lot of people used Scala as "a better Java" back then. I don't know what's the situation with Scala 3 nowadays, but judging from TFA it remains a hybrid language.
- jghn 2y agoIt is also important to keep in mind that there are two very different styles of FP one sees with Scala. Odersky et al envisioned ML on the JVM. And there is also a strong population of Haskell style FP.
- the_af 2y agoYes. I remember Erik Meijer was frustrated back then [1], and advocated going all-in FP, but I don't think that was ever the norm for most developers. [1] "`Mostly Functional` Programming Doesn't Work" https://queue.acm.org/detail.cfm?id=2611829 https://queue.acm.org/detail.cfm?id=2611829
- 2y ago
- flakiness 2y ago- Apache Spark picked Scala in 2014 as a language with lambdas and pattern matching on the JVM. - Akka picked Scala because it was a concise, performant language with support for lightweight concurrency with Futures or Actors. - Scalaz and Cats picked Scala as a concise language with a rich type system. This chronological list perfectly captures how its mental share has shrunk over time...
- SOLAR_FIELDS 2y agoTrue, but also worth pointing out that Akka kind of footgunned themselves by trying a too-obvious moneygrab - not just all Scala’s fault there. Although it is also worth pointing out that Lightbend is Odersky’s company so maybe it is kind of Scala’s fault here
- truth_seeker 2y agowha about improving the compilation time ?
- DeathArrow 2y agoI think Scala had a big momentum 10 to 5 years ago. Many people were choosing Scala for new apps and many were rewriting existing apps in Scala. But something happened, Scala lost its momentum and nobody is interested in Scala anymore.
- leetrout 2y agoThere are better alternatives for almost every domain if you don’t need JVM / Java interop. Julia for mathy stuff. Python with pandas / polars. Rust with polars / actor frameworks. Go for simple systems tooling / api dev. Zig and Rust for systems programming. Elixir / gleam for functional webdev. JS / TS for everything.
- sideeffffect 2y agoAll these languages may work very well for many people for the described use cases. But one of Scala's strength is versatility. You could use it quite well for all the listed use cases too. With just one language. (Maybe with the exception of system programming -- Scala Native still requires a tracing GC.) Also, it's worth noting that Scala is more popular/mainstream/supported/has bigger community than Julia, Zig and Elixir / gleam. And if Red Monk is to be trusted, even more than Rust https://redmonk.com/sogrady/2024/09/12/language-rankings-6-24/ https://redmonk.com/sogrady/2024/09/12/language-rankings-6-2... That comes with many benefits. > if you don’t need JVM / Java interop OpenJDK is also very good, even if it's not a strict requirement to use it. Battle-tested, easily debugable, etc... AOT compilation is possible via GaalVM's native-image. Or you can try Scala.js or Scala Native (which don't have anything to do with JVM).
- DeathArrow 2y ago>All these languages may work very well for many people for the described use cases. But one of Scala's strength is versatility. You could use it quite well for all the listed use cases too. I think that the jack of all trades space is already occupied by C#.
- true_blue 2y agoIt takes a lot of humility to admit that the language just isn't as popular as it once was anymore, so kudos for that. The turn towards making the language more approachable to beginners is an interesting one for Scala, and I think it could have a positive impact on the language.
- didip 2y agoBetween Java and Python getting better year by year and the uptick of Go, Rust, Kotlin, and Swift, at this point in 2025, Scala is pretty much dead, right?
- justinhj 2y agoGood positive direction for Scala. I have written a lot of Scala and made my living almost 100% from it for 7 years. However, three major head winds pushed me away from commercial use: 1. Culture war. The so called culture war came for the Scala community in a bug way. Cancellations and constant arguments threw out a lot of noise and put outsiders off. Employers, technical and community leaders had to put political concerns ahead of technical ones. Ultimately the community split and became silo’d. 2. Lightbend licensing. Not to blame Lightbend for wanting to have a commercial license for Akka but for many the retroactive commercialization was untenable. Akka is a great library for distributed computation and has many use cases so this caused more uncertainty for companies using it. 3. Scala 3. A consistent theme of Scala being part research, part production language means trade offs. The language ecosystem causes non stop maintenance of libraries. Personally I love the rapid pace of new features at language level but for library maintainers and companies it is too fast. None of these issues should kill the language and I think it still has a potentially bright future.