Why Scala, Why do you recommend it?

thanks for the answers what frameworks there are on Scala 3 today? And what are the successful cases?

an aside on version numbers:

Scala 3 doesn’t exist yet. There is a compiler called Dotty that is slated to become the Scala 3 compiler, but nobody is using it in production yet. Well maybe not nobody, but 1% or less of the community, perhaps 0%.

The current stable version of Scala is Scala 2.12. There will be a Scala 2.13 and a Scala 2.14 before Scala 3 comes out, so it’ll be a while yet.

Seth

I like Scala because it combines many nice features:

  • Strong static typing

  • The ability to ability to create classes, traits, extend them and combine different traits (aka OO)

  • Part of Java ecosystem, i.e. runs on JVM, tons of Java libraries and other Java tools (e.g. Tomcat)

  • Ability to call methods +, -, *, / etc (i.e. readable math expressions with user-types)

  • Uniform access, i.e. a.x = b.y, where x and y may or may not be fields

  • Lambdas and methods like map, flatMap, filter, exists, etc. (FP light, if you will)

  • Support for covariant and contravariant types

  • Pattern matching

  • Case classes

  • Implicit classes and conversions

  • Type inference

There are other features which I like to use sometimes, but could easily live without, such as path-dependent types and implicit parameters.

While most of my fields are vals, I do not aspire to eliminate all vars. I use recursion where it appears a natural fit, for example when traversing tree structures or when dealing with recursively defined functions (which happens rarely). I would not use recursion to calculate the Fibonacci series. I therefore only very rarely have the need for tail recursion optimization.

Best, Oliver

2 Likes

I agree. And self-driving cars’ safety record will, I believe, get even better when – decades down the road – all the cars on the road are self-driving. Imagine cars talking to one another, negotiating right of way, sharing what they know about the traffic around them. All while not being the unpredictable wildcards that human beings are while driving / texting / spilling coffee / falling asleep.

Someday, a major city will pass a law requiring that cars going 10mph or more within city limits be in self-driving mode, ushering in an astonishingly low accident rate AND reduced travel times.

2 Likes

no, absolutely I’m against self-driving … because I’m a good driver …

The guy who crashes into you might not be such a good driver though.

Self-driving cars will be configurable according to local customs.

In Istanbul setting, assume one inch is a safe distance, ignore most one-way streets except those that have spike strips, and assume all pedestrians on the road are there at their own risk (no first law of robotics).

In Cairo setting, keep honking, the one who honks the most has priority

3 Likes

Maybe. And maybe self cars will turn out to be a nightmare, with software bugs and security vulnerabilities, and the roads will become too full. Or maybe somewhere in between. We really don’t know the future.

First, this should be a “Why Scala”, not a “Why Scala for Automatic Driving/Flight” or “Why Automatic Driving/Flight” thread. Even OP got off-track, so, wow.

Second, I use Scala because:

  • In comparison to Java, it develops much, much faster. Cannot compare it to Python though (maybe similar speed there?).
  • An expressive type system. With typelevel, even more is added (literal types) when needed.
  • For me, an easy learning curve, coming from Java.
  • Close correlation with a build system (sbt) makes it a breeze to set up and configure a project, and extend it through plugins.
  • The open community, meaning a big amount of libraries, but also easily accessible forks of the language (looking at typelevel).
  • Openness of the development lead to ScalaJS and Scala Native as additional compiler backends. I even feel motivated to look into creating a .NET one as a side project of my studies!
  • Interoperability with any existing JVM library or project is also a big plus.
  • sbt, while not Scala-only, is also a big plus for me on its own. I really, really like sbt.
1 Like

my i ask you a question not about scala?

Depends on the question. :slight_smile:

you will find answer in reddit r/scala