What was your main motivation when you chose a JVM based language, Scala, for the Daml runtime?
In short: portability and safety.
Running Daml code (and indeed all Daml Connect runtime components) as JVM processes decouples Daml from the host operating system to a great degree. There are limitations to this of course, but it’s a great deal easier than using a language that compiles to binary.
It also provides an extra degree of safety between user code (written in Daml) and the host operating system. Should a malicious party manage to break out of the Daml engine (which I consider highly unlikely) they still have to get out of the host JVM before they can do any damage.
Using containers offers most of the same benefits, but portability is actually weaker in many respects, and would probably only perform well on Linux hosts.
Using a “portable” language like Go and compiling to different supported architectures may have been another option, but that ecosystem was (and is) much less well developed than JVM and still means we would need to distribute different binaries for different hosts.
Small addition to @bernhard’s answer, this decision was made in 2015, at the time we interviewed technology/security/operations teams from many financial institutions we were working with. Docker and container technology were considered immature and not approved for production in many of them. There were concerns about the future community maintainability of Go and Haskell since. By and large everyone wanted us to use Java and the Java ecosystem.
At the time we had a prototype platform written mostly in Java, and the precursor to the Daml interpreter was written in Haskell. We decided to standardize on Scala for the runtime because:
1. It met our customers’ requirements
2. It was a relatively easy move for our Haskell devs (although they’ll curse me for saying that…)
3. We thought it would be the easiest opportunity for our Java developers to move into functional programming (in hindsight I think Haskell would have been easier to learn)
4. We looked at the runtime architecture as a Reactive architecture and thought Akka would be a suitable framework. A lot of the Daml runtime design was originally inspired by Reactive principles
Great question, I was just about to ask “Is Daml written using Scala?”.
… just a quick note to anyone who writes a post: remember to use ‘tags’ to classify the post, with 2 or more tags if necessary.
This allows forum post searches to be more accurate.