In what way does Scala have Python's convenience and Go's concurrency? Based on talking to a few people that used Scala in the past they said they wouldn't use it again and they said I probably wouldn't like it.
In what way does Scala have Python's convenience and Go's concurrency? Based on talking to a few people that used Scala in the past they said they wouldn't use it again and they said I probably wouldn't like it.
Written in a certain way, it's that different from writing Python 3 with PEP-484 type annotations. You can easily write Python-like code and just get things done. :)
Concurrency-wise, you can implement any concurrency model you want on top of it, and, personally, I find immutability + Task-like implementations (Monix, ZIO, IO, etc.) easier to understand than CSP, but that's just me. There's also actors & channels & threads & anything else you could want.
What's cool, though, IMO, is that once you need more power than just Pythonic Scala gives you, it has one of the most powerful type systems in the world; you can verify as much as you need to, and refine things over time. It's not a language that hamstrings you once you do need more power.
Scala gets its bad reputation from that huge surface area and flexibility, though. There was a period (2009ish, maybe) where the Scala community was having a field day with its flexibility via custom operators like '<<++>>' and implicit conversions and untyped actors that made it impossible to figure out what was going on. It was like using the worst of Erlang with the worst of Haskell with the worst of Java. I'd say they've matured past that entirely, though; in 2020, it's one of the nicer and more practical languages, ecosystem, & communities IMO. Scala is made for getting things done.
Is there a concrete example of the Python-like code vs the more complex ones? I appreciate the help.
I'm thinking what language next should I pick up. It is either OCaml or Scala.
Haha this book is going to be 400 pages of concrete examples. It's not out yet, so you'll have to take my word for it for the next few weeks while the last round of reviews and editing are incorporated into the manuscript. If you're interested, put your email down and I'll let you know when it's ready!
Scala is a pretty great investment for services, big data, etc. It has a robust ecosystem.
However, the compiler is slow, and startup time can be slow (and Graal and Scala Native just aren't options yet), and if I want to make some tool that gets called fast in a loop or deploys as a "small", native binary, OCaml is nice alternative which I prefer to the only other compelling entry in this area, Go.
avoids the complexities
of the scala FP purists.
Are you sure? Have a look at Arrow [1] and similar! I am glad that languages offer pure FP frameworks, so I can use them if I think they are the right tool for the job, and can avoid them otherwise. It's an important software engineering choice which style of programming to use, especially with multi-paradigm languages. But the language should not enforce them!Most Scala programmers are probably just maintaining Play apps or using Apache Spark, with no pure FP in sight. The pure FP contingent is just very active and vocal online.
Every time you dare use something as impure as a mutable object, or a non-const reference (so var instead of val), or even want to look up an item in a collection by index (unsafe operation since it will throw exception if index >= length) you'll have to prepare for a heckling from your team mates. Anyone you might ask help from online will first look down their nose at you for even wanting to do something so despicable, and you'll have to humour them with "well yes oh great FP lords, I know that this is really really bad I know, but I have to for .... reason, please help me anyways!".
I think it’s less of an issue at large companies like Twitter, Asana, Databricks, etc, which overall probably employ most working Scala programmers but not the most vocal.
Spark (and Kafka too maybe) are outliers here.
throw exception
This is a good example. It is really important to be very clear from Day 1 how to handle errors in a project. One hybrid choice that is popular is: use exceptions for errors that you cannot recover from, use Options for local error handling.Features we know Scala 3 will have https://dotty.epfl.ch/docs/
A comparison of features across Scala 2.x and Scala 3 is the migration guide https://github.com/scalacenter/scala-3-migration-guide
It has a lot of what makes Scala good with less of the bits that make it bad.
I still prefer Scala, but found Kotlin to be enjoyable to write as well. Probably a perfect gateway into Scala if that's an eventual goal too.
What? You can certainly use scala.util.Random from scala.js, there are very few Scala features that Scala.js does not actually support, such as blocking (because javascript) and reflection.
> Because this is the scala api that the scalajs folks expose - https://www.scala-js.org/api/scalajs-stubs/latest/#scala.pac.... . So that's fewer than 70 types.
That's not everything that's available in Scala.js, those are just some stubs for smooth cross compiling.
---
Scala.js is certainly not for every project. It's not a better typescript than typescript is. But typescript also isn't the right tool for every project.