Live data from Hacker News

Explicit term inference with Scala 3

scala-lang.org

1–10 of 77 posts

Re: Explicit term inference with Scala 3

#2
After a couple weeks of dabbling between Scala and F# to migrate Python and Node.js codebases (at a scaling startup serving big enterprises) I ended up choosing F#.

Scala is a beast and the package manager + build tools were giving me headaches. I’m optimistic about the current trajectory with Scala 3 and simplifying the language.

Re: Explicit term inference with Scala 3

#3
post #2

After a couple weeks of dabbling between Scala and F# to migrate Python and Node.js codebases (at a scaling startup serving big enterprises) I ended up choosing F#. Scala is a beast and the package manager + build tools were giving me headaches. I’m optimistic about the current trajectory with Scala 3 and simplifying the language.

I think F# is really underused - it fills a very similar spot in the trade off space and from what time I have read has excellent design.

Re: Explicit term inference with Scala 3

#5
This is a nice write-up, it's beeb some time since I've written Scala and Scala 3 looks promising.

Though, I am curious if there is anyone else who shares my mindset on Scala.

In a corporate environment, I found it to be an extremely expressive and powerful language but that power comes at a grave price, which I'll try to summarize:

- it's difficult to understand other people's code compared to other languages (e.g. Go) - it's so very implicit that you end up having to hold a lot of state in your head to understand what's going on. - the language is basically impossible to read effectively without IDE features.

I usually enjoy reading most code bases, but Scala is downright painful to read in plaintext. You end up having to be a compiler.

Re: Explicit term inference with Scala 3

#6

This is a nice write-up, it's beeb some time since I've written Scala and Scala 3 looks promising. Though, I am curious if there is anyone else who shares my mindset on Scala. In a corporate environment, I found it to be an extremely expressive and powerful language but that power comes at a grave price, which I'll try to summarize: - it's difficult to understand other people's code compared to other languages (e.g.…

> it's difficult to understand other people's code compared to other languages

I think it depends a lot on the code. Scala 2 gives you a lot of guns to shoot yourself in the foot (see: implicit, as discussed here) - but you can also use it in its mostly-functional form, with immutable values, and then it can become very readable. Granted - I've always been using IntelliJ but I could read the scala code on Github too, just fine.

Re: Explicit term inference with Scala 3

#7
post #2

After a couple weeks of dabbling between Scala and F# to migrate Python and Node.js codebases (at a scaling startup serving big enterprises) I ended up choosing F#. Scala is a beast and the package manager + build tools were giving me headaches. I’m optimistic about the current trajectory with Scala 3 and simplifying the language.

> Scala is a beast and the package manager + build tools were giving me headaches.

Ignore them and use maven. It's much better documented, consistent, and backwards-compatible. I struggle to understand why SBT ever gained any popularity, and it should certainly have never been recommended to newcomers.

Re: Explicit term inference with Scala 3

#8

This is a nice write-up, it's beeb some time since I've written Scala and Scala 3 looks promising. Though, I am curious if there is anyone else who shares my mindset on Scala. In a corporate environment, I found it to be an extremely expressive and powerful language but that power comes at a grave price, which I'll try to summarize: - it's difficult to understand other people's code compared to other languages (e.g.…

In a good Scala codebase you use the implicitness to put the business logic front-and-center and push secondary concerns into the background, but without making them completely invisible. The plaintext becomes something akin to the DSLs that people write in e.g. Ruby (using metaclasses and other such magic), but when you open it in an IDE (or compile it in your head) all those extra details become visible to you in a reliable way, rather than having to guess what a given piece of code actually does.

IMO modern language designers should be making IDE-first languages - after all, most serious programmers do use IDEs (even if they build that IDE within Emacs or Vim). The problems with "visual languages" are that without a textual representation you can't meaningfully diff/merge/blame, not that using the GUI is an inherently bad idea. With Scala you get the best of both worlds: it's textual enough that version control works properly, but you have standard-ish way of folding, hovering etc. that mean that you can "zoom in" on the details of unfamiliar code but also "zoom out" to get a clear overview, in a way that few other languages manage.

Re: Explicit term inference with Scala 3

#9
A summary of what Scala is great for:

- Safe and high performant concurrent programming. Scala is miles ahead of most other languages here and pretty much on par with the best ones (such as Haskell)

- ETL / data transformations. Python is a big player here - but for stable and performant data pipelines, I strongly believe Scala is the better choice. For explorative things, python has the edge though.

- Actor systems on the JVM. I believe that most "scalable" systems are over-engineered. A well configured postgres / elasticsearch and a machine with your application on good hardware goes _very_ far. But sometimes it's not enough and then Scala offers a great solution with Akka on the JVM. Erlang/Elixir with their runtime are probably even better, but Scala offers the better typesystem and one can stay in the JVM world if they want.

- in-language custom DSLs. No seriously, Scala is the best language I know in terms of building typesafe, customizable DSLs within the language, making it almost look like another language. This is great if not so techy folks are to make changes to actual code in an easy way. The link in this post here shows some examples but it goes beyond.

- Writing glue-code. Surprisingly, I think Scala is better than python and many other languages here, because of the sheer power of composability of the language and ways to connect pieces with each other in a typesafe manner. The reason for this lies mostly in the concept of implicits, which both enables great power and reusability but also makes the learning curve much steeper.

This list might be a bit subjective and I don't know every language out there, but as the questions comes up almost everytime, I wanted to list the strengths of Scala in the areas where most other languages can't compete with it.

Re: Explicit term inference with Scala 3

#10
post #7
post #2

After a couple weeks of dabbling between Scala and F# to migrate Python and Node.js codebases (at a scaling startup serving big enterprises) I ended up choosing F#. Scala is a beast and the package manager + build tools were giving me headaches. I’m optimistic about the current trajectory with Scala 3 and simplifying the language.

> Scala is a beast and the package manager + build tools were giving me headaches. Ignore them and use maven. It's much better documented, consistent, and backwards-compatible. I struggle to understand why SBT ever gained any popularity, and it should certainly have never been recommended to newcomers.

Personally, I wouldn't recommend Maven to beginners. I would recommend beginners to learn Maven as it is one of the de-facto standards in JVM dependency management, but the documentation is highly confusing and the learning curve is very steep. Beginners will likely struggle with Maven concepts.
Post reply on HN