Live data from Hacker News

Scala Resurrection

degoes.net

31–40 of 47 posts

Re: Scala Resurrection

#31
post #9

Earlier quoted context omitted.

Scala is both more functional than F# (type system has more features) and less functional (more emphasis on OOP). I don’t think it’s a net improvement tbh. Better JVM access is nice though.

Why would OOP and functional programming be at opposite ends of a spectrum?

A good example would be [1], where covariance and contra-variance are offered to you by the language due to its relation to OOP and the need for subtyping for it, whereas you'd probably be better off if you forgot about their existence (most of the times) and designed everything with Invariance and higher-kinded data [2].

[1] https://docs.scala-lang.org/tour/variances.html

[2] https://reasonablypolymorphic.com/blog/higher-kinded-data/

Re: Scala Resurrection

#32
post #9

Earlier quoted context omitted.

Why would OOP and functional programming be at opposite ends of a spectrum?

Minimising state vs hiding state behind interfaces / methods The two can coexist in one code base but they are fundamentally opposed.

A common joke in my previous org that heavily used Scala with functional paradigms is that an engineer’s first few PR’s were often implemented in “Scava” since Scala lets you lean into OO paradigms. It kind of means that there are two (or more) “right” ways to do things in Scala which IMO is a detriment to the language. This is where other languages like Python got it right by introducing the concept of “Pythonic”. You can do weird stuff, but it won’t be accepted into the zeitgeist that was defined by the benevolent dictator.

Re: Scala Resurrection

#33
post #26

Earlier quoted context omitted.

How do you get over the lack of type inference in Scala?

Scala has type inference [1] [1] https://docs.scala-lang.org/tour/type-inference.html

Scala's type inference is not very good, especially in comparison with Haskell

Re: Scala Resurrection

#34

To be honest, I think he is way-overly critical. It would seem like he thinks there needs to be some sudden changes or something. Scala is great today - there is nothing better (for experienced programmers) in my opinion (at least when it comes to backend development), and it's on a great path and trajectory. Slow progress and change is good. I think he would do well just calming down a little bit. He has some good c…

Over 9 years of Scala here. Scala definitely has quite a few warts.

I don't see anything better, or even close

Re: Scala Resurrection

#35
post #26

Earlier quoted context omitted.

How do you get over the lack of type inference in Scala?

Scala has type inference [1] [1] https://docs.scala-lang.org/tour/type-inference.html

Yeah it works whenever you yourself can infer the type without it already.

Re: Scala Resurrection

#37
I was a big fan of the Scala language some years ago and really like the improvements made in Scala 3. But I lost my confidence in Scala and the article is more a confirmation of this assessment than something that would give me hope that I would return to this powerful and beautiful language in the future.

Let me go through some of the points of this excellent write-up.

> However, Java has a very simple type system that is static and well-defined. Scala’s type system is extremely complex and defined only by the implementation, which itself has numerous quirks, edge cases, and of course bugs. Moreover, the semantics, quirks, edge cases, and bugs all vary somewhat between minor versions of the Scala compiler, and are completely different between major versions.

This is a very good summary of why Scala is not a good fit for tool support.

> Perhaps their next-generation editor Fleet is an acknowledgement both of the fact that JVM desktop applications are truly dead

The author probably doesn't know that Fleet is also built upon the JVM!

> The truth is Fleet is built on a reliable, performant and wonderful platform called the JVM.

https://blog.jetbrains.com/fleet/2022/01/fleet-below-deck-pa...

> In short, there are no IDEs for Scala right now with a modern experience suitable for commercial software development, nor any obvious path to a commercial-grade IDE.

Even the best Scala IDE (IntelliJ IDEA) is poor and nothing better is to be expected in the next years. This is basically the point where you could cross out Scala from your short list of programming languages!

Akka, once the most prominent Scala framework, is essentially doomed since the company behind it decided to switch to "Business Source License".

> Thus, every company I have talked to about Akka has told me they are ripping it all out.

The former killer application of the Scala ecosystem no longer drags any new developers into it.

ZIO as a potential Akka (and Spring) alternative is stil not mature, so probably not the reason to switch to Scala.

> It is virtually impossible for Java or Kotlin code to call into Scala code. [...] Scala’s support for newer versions of Java, as well as new JDK or JVM features, lags behind. When the JVM gets value objects, for example, it is quite likely Scala support will severely lag; or as another example, the Scala compiler itself has been known to crash on modern JVMs.

I'd say that Scala is not a good citizen in the Java world. This is problematic in existing code bases. Kotlin is a much better fit there.

Scala Native (LLVM) and Scala.js or WASM are far from production ready yet. One major problem is missing tool support and I can not imagine any responsible software engineer would pick it as the basis for a new critical product. If anything else than the JVM is needed as a runtime, you should probably use somete other language, maybe Rust or Go (or Kotlin?).

> It is absolutely true that Scala 3 is not a perfect language. It is also true that Java is not a perfect language. Yet Java remains backward compatible with the very first Java program ever written, which allows the ecosystem to continuously improve, and which gives companies confidence in investing in the Java programming language.

That is absolutely the core of the "Resurrection". The Scala community was too long focussed on the language itself ignoring all other aspects like tooling and existing code bases. Maybe this is no surprise if you look at Scala's history, but it is a big problem in practice. The best language is worth nothing if everything else is poor compared to the competition (be it Java, Kotlin, Go, Rust or whatever ...). Essentially Scala is the Haskell of the JVM, but the Haskell community decided early on that academics is their focus and that it should stay that way. However, Haskell is therefore a niche language in commercial projects. The Scala community should really make a bold decision for one of the sides, but it should no longer wander between the two camps.

As the author writes, Scala need completely new tooling: a new IDE, a new build tool replacing the horrible SBT, and a new package manager. But who should build it in a sensible time? Who should invest money?

> Does Scala really need 20 JSON libraries, 5 schema libraries, 9 CLI libraries, 4 effect system libraries, and so on? Probably not. We need to consolidate, and rally around strong projects; merge our strengths, cancel our weaknesses.

This assumption is simply not realistic. What was the original motivation to create those libraries? Has anything fundamentally changed? It is not like in a big corporation where you would should down one of two competing projects (like Microsoft did with Atom in favor of VS Code). Just look at the Linux desktops ...

"Worse is better." (https://en.wikipedia.org/wiki/Worse_is_better) seems to apply to Scala very well. Go, which is probably on the other end of the spectrum of programming languages in expressiveness and the type system, is probably a much better bet for most companies. Java is also quite good these days and in any case "good enough" for almost all commercial projects (as long as technical constraints don't require something without a VM). Kotlin is somewhere between Scala and Java, highly productive with world class tooling and a healthy ecosystem. I can not really see in what niche Scala could exist.

So, as sad as it might be, I think Scala has no bright future.

Re: Scala Resurrection

#38

Scala is a great language. Any time I'm programming in other statically typed languages it's like programming but with my hands tied backward: bumping into things and realizing there's no HKT, Type Class, GADT etc. However, it's sad to see it's growth is likely to be capped - because JVM languages is not that fashionable like 2003 or 2007. What's in nowadays is Go and Rust: bear metal, small binary, fast startup spee…

Maybe Rust is close enough to this ideal imaginary Scala-like language. I'm not a Rust expert, but I really like how Rust combines power with a certain minimalism (not in the Go sense, though). There are, for example, no classes with inheritance in Rust, but traits, whereas Scala has traits an all the Java OOP heritage. Another thing is error handling that is handled with return types in Rust, where Scala has also exceptions from the JVM. Same is true for null, what probably shouldn't exist in any modern functional language. Rust doesn't have it while Scala needs it.

Re: Scala Resurrection

#39
post #38

Scala is a great language. Any time I'm programming in other statically typed languages it's like programming but with my hands tied backward: bumping into things and realizing there's no HKT, Type Class, GADT etc. However, it's sad to see it's growth is likely to be capped - because JVM languages is not that fashionable like 2003 or 2007. What's in nowadays is Go and Rust: bear metal, small binary, fast startup spee…

Maybe Rust is close enough to this ideal imaginary Scala-like language. I'm not a Rust expert, but I really like how Rust combines power with a certain minimalism (not in the Go sense, though). There are, for example, no classes with inheritance in Rust, but traits, whereas Scala has traits an all the Java OOP heritage. Another thing is error handling that is handled with return types in Rust, where Scala has also ex…

Rust has no GC and, unlike Scala, doesn't embrace full immutability. This is of course fine, because it focuses on performance, but it means a very different development experience.

Also, Rusts typesystem is lacking many of Scala's features and I don't think it's realistic to add them retrospectively.

Re: Scala Resurrection

#40
post #4

To be honest, I think he is way-overly critical. It would seem like he thinks there needs to be some sudden changes or something. Scala is great today - there is nothing better (for experienced programmers) in my opinion (at least when it comes to backend development), and it's on a great path and trajectory. Slow progress and change is good. I think he would do well just calming down a little bit. He has some good c…

Would you recommend someone currently using F# to try out Scala?

F# does not really support pure functional programming in the sense that Scala does, so yeah. Use Scala ZIO and you will see what I mean.

It also has some other nice features that F# lacks. But F# also has some nice things that Scala lacks. Overall I think it's worth to learn it for learning new concepts, but F# is already great, so don't expect Scala to be way ahead and even worse in some ways (syntax, no type providers, ...)

Post reply on HN