News for hackers. Stuff that matters.
Re:From First Principles: Why Scala? by occupy_paul_st on Thursday February 11, 2021 @09:39AM (#26101891)
I definitely agree that many newer languages are strongly inspired by Scala, but I don't see a strong argument for why to choose Scala over one of a newer hybrid language. My own intuition is that these newer languages have had the benefit of being able to learn from Scala's mistakes. A lot of them have intentionally sacrificed some of the Scala's flexibility to be easier to learn and use.

I found Scala to be an extremely enlightening language: it taught me a lot about functional programming. But, the complex type system and the sacrifices needed to ensure Java compatibility entail many quirks that I find frustrating. I think it's actually a similar dynamic to what you mention: "retro-fitting these features onto an existing language never fits quite as nicely as a language that was designed with them from scratch."

BTW, I am a huge fan of your writing: the Principle of Least Power is a sacred programming text to me .

Re:From First Principles: Why Scala? by lmm on Thursday February 11, 2021 @10:09AM (#26102197)
> I definitely agree that many newer languages are strongly inspired by Scala, but I don't see a strong argument for why to choose Scala over one of a newer hybrid language. My own intuition is that these newer languages have had the benefit of being able to learn from Scala's mistakes. A lot of them have intentionally sacrificed some of the Scala's flexibility to be easier to learn and use.

I don't believe any of those new alternatives has made better choices; some of them haven't had time to accumulate as many warts as Scala yet, but all of the ones I've seen have design decisions that make them inevitable. Higher-kinded types still work much better than every other way of achieving the same things that's been found - and if you want both higher-kinded types and decent tooling/library support, Scala is still pretty much the only option. (Haskell exists, but even if you consider its tooling good enough, implicit pervasive laziness has huge costs).

Re:From First Principles: Why Scala? by imtringued on Thursday February 11, 2021 @10:03AM (#26102142)
>the sacrifices needed to ensure Java compatibility entail many quirks that I find frustrating.

That reminds me of that dead JVM language called Ceylon. It didn't compromise anything to ensure Java compatibility. The combination of OOP+FP was executed with zero friction. Meanwhile Scala did it so poorly it created a stupid myth that OOP and FP shouldn't mix.

Of course everyone knows that nobody used Ceylon, not even Redhat who sponsored the language. The compiler was also dog slow. Typechecking complicated type unions/intersections can get really slow with bigger projects. The metamodel also created a lot of JS bloat if you were brave enough to use it in the browser. Lots of practical complaints that ultimately make you stop using it. But oh man the idea and design. It was very well thought out and enjoyable to program in.

Re:From First Principles: Why Scala? by stickfigure on Thursday February 11, 2021 @11:06AM (#26103100)
Ceylon was (is?) really beautiful. At least type unions/intersections found their way into Typescript.

IMO Gavin's biggest mistake was picking Eclipse for the IDE platform at a time when every professional was moving to IntelliJ.

Re:From First Principles: Why Scala? by valenterry on Thursday February 11, 2021 @06:44PM (#26109080)
And into Scala 3 too!
Re:From First Principles: Why Scala? by pegasus on Thursday February 11, 2021 @10:01AM (#26102109)
Scala has learned from Scala's mistakes too. Scala 3 cleans up a lot of the mess that had accumulated over the years and is on the cusp of being rolled out this month.
Re:From First Principles: Why Scala? by Cthulhu_ on Thursday February 11, 2021 @10:27AM (#26102445)
I feel like Scala started a trend in language design, where every language adds features from other languages. Not because there's a need, but because some people are used to language X.

Example: adding OOP in PHP and Javascript. In both examples, especially the first attempts, were half-baked. Why bolt on half a language feature? Both languages would be much better served with dependency management and / or modules, which for both languages came out of the community at first.

Counter-example would be Go, that resists change - especially if it's requested with a "this feature is in language X! I NEED it!". From the FAQ: https://golang.org/doc/faq#Why_doesnt_Go_have_feature_X (followed by some features other languages have. Generics / type arguments is one that will probably be added in an upcoming version of Go, but they only considered it once they fully understood the problem and need)

Re:From First Principles: Why Scala? by mrkeen on Thursday February 11, 2021 @02:08PM (#26105752)
> Counter-example would be Go, that resists change

It will happen, just slower. Just as half-baked.

Re:From First Principles: Why Scala? by still_grokking on Saturday February 13, 2021 @05:02AM (#26122615)
JavaScript was OO form day one. There aren't even much languages that are so consequent OO like JavaScript. Everything is an object even functions.

JavaScript is actually quite similar to Self (besides the syntax), which itself is a kind of a SmallTalk like language. It's hard to be more OO than that. :-)

Re:From First Principles: Why Scala? by valenterry on Thursday February 11, 2021 @06:45PM (#26109089)
> Counter-example would be Go, that resists change

Now it gets generics, so we are one step closer to Scala. :)

Re:From First Principles: Why Scala? by mbo on Thursday February 11, 2021 @09:16PM (#26110080)
Even with square-bracket syntax!
Re:From First Principles: Why Scala? by yawaramin on Thursday February 11, 2021 @01:06PM (#26104978)
> I don't see a strong argument for why to choose Scala over one of a newer hybrid language.

Scala has been in production use and getting bugfixes for longer than some of the newer languages have existed. I feel like a re-read of https://www.joelonsoftware.com/2000/04/06/things-you-should-... is warranted.

Re:From First Principles: Why Scala? by playing_colours on Thursday February 11, 2021 @09:49AM (#26101986)
What newer hybrid languages besides Kotlin can cover the benefits you can get with Scala: a solid ecosystem (both for Scala and Java) for developing web applications, microservices, data processing, and good performance.

Julia, Rust, and Elixir are all great, but popularity, ecosystem are not there yet.

Re:From First Principles: Why Scala? by dunefox on Thursday February 11, 2021 @10:02AM (#26102130)
For Julia there are PyCall and RCall, so the ecosystem is less of an issue than with other languages. Also, its ecosystem has been growing quickly over the last 2 years or so.

https://github.com/JuliaPy/PyCall.jl

https://github.com/JuliaInterop/RCall.jl

Re:From First Principles: Why Scala? by occupy_paul_st on Thursday February 11, 2021 @10:13AM (#26102255)
I actually haven't seen a language that can do everything that Scala can do, so in a lot of senses I agree with you!

The alternative is to use multiple different languages to fill different niches. In theory this sounds suboptimal but I think it might actually be easier to learn multiple simpler languages than it is to learn Scala.

BTW according to PYPL: Swift, Kotlin, TypeScript, and Rust are now more popular than Scala.

https://pypl.github.io/PYPL.html

Re:From First Principles: Why Scala? by didibus on Thursday February 11, 2021 @10:48PM (#26110558)
I've switched to Clojure, it covers all those basis.
Re:From First Principles: Why Scala? by jolux on Thursday February 11, 2021 @10:08AM (#26102185)
F#
Re:From First Principles: Why Scala? by lihaoyi on Thursday February 11, 2021 @01:03PM (#26104941)
I actually came to Scala via F#. You can even find exact dates of those transitions in my stackoverflow history.

Scala and F# are sinilar enough to basically be the same language, though I found F# had a number of warts and idiosyncracies that made me move on to Scala. Scala didn't have all of these (though of course it had warts of its own!) and is what stuck with me for the long term

Re:From First Principles: Why Scala? by smabie on Thursday February 11, 2021 @05:59PM (#26108614)
F# has a much more primitive type system than Scala and isn't particularly impressive imo. And it doesn't have functors ala OCaml.
Re:From First Principles: Why Scala? by jolux on Thursday February 11, 2021 @08:23PM (#26109792)
What I like about F# vs Scala is the ML-style syntax and the relative simplicity. I have found Scala staggeringly complex every time I have tried to learn it, it seems like the C++ of functional programming languages. This impression may be misguided.
Re:From First Principles: Why Scala? by davnn on Thursday February 11, 2021 @10:54AM (#26102912)
> BTW, I am a huge fan of your writing: the Principle of Least Power is a sacred programming text to me .

That principle is actually directly from the CTM book, which seems to have been a great inspiration for Martin Odersky in the language design.

Re:From First Principles: Why Scala? by still_grokking on Saturday February 13, 2021 @05:15AM (#26122675)
I to this day don't get what's wrong with Scala's marketing, as people are complaining about the "complex type system" but nobody does so for TypeScript.

Same for compile times. TS compilation is ridiculously slow yet there're no complains whatsoever out there. Scala compile times are OK on the other hands side, especially if you ever used C++ with similar complex code, or TS like said, but "the slow compiles" are a topic now for years.

Just makes no sense to me, don't get it.