Hacker News new | ask | show | jobs
by shrugger 3649 days ago
Well, Scala was originally designed to complement a platform that encourages mutable data structures. When Scala was first getting started, Java didn't have anonymous functions yet, and it was a different time.

Currently, Scala-Native is working on off-JVM Scala, Scala.js is already plenty capable of compiling to efficient JS, and when wasm lands, it'll probably manage that rather easily.

Elm is a neat language, but I think it sort of presents too wide a divide. I have the same problem with Elm as I do with Typescript, Dart, and all of the other languages that recognize JS is a shit language, but just compile to it anyways.

Scala is a VERY well-designed language, and FP/OOP isn't nearly as polarizing as it might seem. I'd recommend LearnXinY Scala, read a little bit and you might see how natural it actually is (excluding the obnoxious syntax for certain things)

But yeah, JS has always been the crucial problem that needs to be solved. *.js is never going to solve it.

1 comments

<opinion> OOP+FP is the wrong approach, and I'm putting that kindly. (This is also why I nixed Clojure, btw.) Having worked on large OO codebases, dependency hell, side effects, runaway state, and mutable data bugs (not to mention concurrency bugs) eventually become a serious problem, and out of the box, OOP does nothing to discourage these things (but functional languages do). As soon as you give developers access to "impurity" along with their "purity," you start earnestly down the path to massive technical debt. You could code the most functional Scala code ever, but as soon as you incorporate any library at all, you are right back to "zero concurrency guarantees" square 1.

What I'm getting at is that OOP+FP is, ultimately, simply OOP, providing none of the guarantees and encouraging none of the best practices that purely FP langs do. It's like the worst of both worlds lol

</opinion>

I develop in Scala and I honestly have never experienced the concerns you are raising.

"OOP" implies none of things you are worried about and Scala is a great example of that.

I wished people tried the language before making assumptions based on emotions that are not supported by reality.

What's the largest Scala codebase you've worked on, and what kinds of challenges have you run into?
10000s to 100000s roughly.

I think the important part is to think about how to properly modularize your codebase and not overdoing it. That gets you an "internal" library ecosystem and not only ensures that incremental builds are fast (not really a concern anymore on nowadays) but also fast parallel compiles and deploys.

Code reviews are of course important so that developers are on the same page, but Scala is really great about isolating parts that have to be complicated from the rest (not like Java's " oh, you used a wildcard over there, let's infect the whole codebase with it").

So life is pretty good and I don't think there are huge issues you have to keep in mind compared to other languages, despite the goodness Scala provides you with.

I think most outside concerns are largely overblown: E. g. some people coming from Java might be excited in the first week bring able to define some operators, but it doesn't really matter. Most of the symbols you see in practice are pretty standard (+, -, ... for arithmetic, a few collection things like + (add one thing), ++ (add multiple things) etc.). Going overboard with it is considered bad style, so most libraries out there just don't do it anymore.

Tooling is pretty great overall, although IDEs could always be a bit better.

Compatibility is great and releases are rock-solid, even things like Scala.js which hasn't even reached 1.0 yet.