Why Scala is not popular

I started programming in 2015, and in summer 2023 I began learning and using Scala for personal projects.

Scala might not be very popular, but IIRC, out of all languages focused on functional programming, it’s still the most popular programming language, which is an achievement by itself.

From a non-professional perspective of someone who is new to Scala, it’s a very simple and complex language at the same time. It’s simple in my opinion because it’s a pleasure to read and write on it and it’s simultaneously elegant and pragmatic in how you can write algorithms. It’s complex because it has a lot of keywords, and many ways to do the same thing (curly braces vs indentation in Scala 3, multi paradigm language that can be used for functional, object-oriented or procedural programming, etc).

It seems to me that a language’s popularity suffers (positively or negatively) from the snowball effect, where there’s an inertia that keeps the most popular languages at the top, until there’s a language that satisfies an urgent necessity.

Functional programming is still a niche, and many times less straightforward than procedural programming. I love making sure at least 90% of my code in Scala is immutable and has no side-effects, while also abusing the hell out of recursive functions and function composition, but I still don’t know what the hell a monad is. Other people might not like the idea of recursion and immutability either.

As for people who are just discovering programming, they tend to hop on the most popular languages first.

I have yet to use SBT on my personal projects, I just prefer to use the compiler directly and manage my stuff manually. I just feel that it’s a bit overwhelming for my projects. For comparison, Rust’s cargo is very simple and straightforward, and it’s not a hassle to use it even for tiny projects.

Kotlin is quite popular in comparison, maybe because it’s more traditional, and so straightforward to get into, but Scala is more fun and interesting, at least to me.

Have you tried scala-cli instead of using scalac directly?
It is very simple to use.

(And some time (hopefully soon) scala-cli will be the new scala command for compiling and running and packaging)

2 Likes

I checked it out once but didn’t experiment much with it. I’ll try it out more thank you.

I have a general idea that you need SBT to compile Scala to native machine code, or to include the Scala runtime in the JAR so it can be launched with any java instance. Is it possible to do both of these on scala-cli?

It is, there is a lot of packaging options, but they require the additional power options, since that was not yet accepted by the SIP comitee.

More info here Package ⚡️ | Scala CLI

3 Likes

I disagree with 1 (I find IDEA very usable), I strongly agree with 2 and 4, and I have no opinion regarding 3. I’ve made my peace with sbt by sticking to the same build files for all projects, with minor variations, but I still very much dislike the tool. As for 4, I think it’s a major problem. Scala was designed as a hybrid language, not as the new Haskell. The purists often seem to carry too much weight in the Scala community.

I suppose calling IDEA not decent is too harsh indeed, as I also use it successfully.

However I must still deal with frustrating issues on a regular basis, even when used with scala 2.13. For instance I routinely encounter incorrect red highlighting, faulty renamings, or bugs in templates (for some reason it likes to use a random String alias of mine wherever “String” appears in a template, including with the ubiquitous template for “main” - gotta love that one!)

1 Like

If you use scala-cli header directives for simple things (and “build” with scala-cli) and mill for less simple things, you can mostly ignore sbt.

1 Like

I’ll look into it. Right now, I’m running programs through sbt in fork mode (in order to better set JVM options), which I don’t like.

The thing that worries me, from the documentation, is this:

At the present moment, support for IntelliJ is often problematic.

Keep an eye on SCL-21585 where Jason is working on a somewhat fundamental fix for type projections IIRC. It will hopefully fix many “good code red” IntelliJ issues.

3 Likes

IDE support. Bad sales. API doc web interface is bleh.“Complex”

I deal with other languages on occasion. Get a chuckle out of them solving, with great effort, “solved” problems.

Look at what they need to have a fraction of our power

Thats a nicer looking annotation processor. I used one that pretty much had to replicate much of scala’s built in macro system for just itself.

Then we get to python. “it has a ty0e system!” Oh cool. Let me know when ya hit the 2010s. Im sitting here writing domain specific static analysis with scalameta. But yea, puthon can accept “types” now.

Not to mention the long term stability the JVM provides. Not just of long running processes but long term support for running stuff from years ago. I aint got the time to rebuild my damn environment every time with only a narrow hope it doesnt fail at runtime. Oh my new runtime conflicts with another project? Wow… What a great problem to throw engineering time at that shouldnt exist.

Sbt is great but arcane.

Anyways my flights here. Time to ditch this bar.

Scala didn’t even make it onto today’s “Connections” puzzle board.

image

3 Likes

I’m probably late to this, but my frustrations when I started was that it was very difficult to debug problems without an IDE that could tell me the type Scala thought the variable was, because often the error was that I was calling the wrong thing, or I thought it was type A but it was actually returning Future[A] or something. Or I’d made a mistake and put the variables in the wrong place and the type inference was figuring out a way to make it work, but it wasn’t what I intended.

The other thing was that often things that I didn’t understand were REALLY important, but not explained. Like, when I was learning Play’s JSON system, I couldn’t find the documentation for a bunch of functions that were in the examples, but were included implicitly to make the syntax “more functional”, but I also accidentally left out the import to the package I thought I didn’t need, and I couldn’t figure out why it couldn’t compile because a function that wasn’t part of the class couldn’t be found. I agreed with the compiler completely; I also couldn’t find the definition! But, because that was very theoretical or complicated, that part wasn’t documented; it was just assumed you’d copy-and-paste the example. But I always try to type them out to make sure I understand what’s happening, and you find out what’s important when you mis-type something.

I don’t know. I was introduced to it as part of a previous job, and I use it a lot for personal projects now because I like the challenge and the different way of architecting problems, but I also work at a company that publishes its own language and 1. they want us to “eat our own dogfood” and 2. the language doesn’t have any of those features. So there’s no question of popularity or not; I can’t really use it at work.

2 Likes

I’m sorry but this strikes me as an awfully odd question. The question that arises for me is, why is Scala so popular given the lack of support its had from key players? Yes Scala had Twitter, but they had to win that they didn’t start with it, but that’s nothing like the backing you get from Google, sun / Oracle, an IDE company, Mozilla or say Microsoft as in the case of Haskell.

The only explanation that I can see for the remarkable success of this little niche academic project is that it got the fundamentals right, significantly more right than the established languages or the languages with far more powerful backing.

Its even more remarkable when you remember that Scala is a compiled language with a highly sophisticated type system. Its much easier to start a dynamic language on a shoe string with minimal resources.

6 Likes