Scala 3 is ... gluten-free!!!

2021-02-21 Software-Craftmanship Functional-Programming Nerdy Scala

A couple of month ago I started to have stomach cramps. First it was only once week, but then it was more or less constant.

Funny enough I had to find out that (even) late(r) in life you can “become” gluten-sensitive/-intolerant. Means … a couple of weeks ago I got myself tested and changed my diet (to (mostly) gluten-free) and (big surprise !!!) … after 3 days I was pain free!

But … I am still learning what I can eat and what I can’t eat. Last week I had some bad food (I think a not-excactly-gluten-free meatball sauce) … and paid for it with a day of stomach cramps.

While I was recovering I was looking for something to sooth my stomach. Some people use Coca-Cola and bretzle-sticks. That’s not really my thing.

Instead I figured (given that it will be released this year) I try writing some Scala 3 code to see how that feels. And I am happy to report that writing Scala 3 code is very soothing (at least for me) and I can confirm that Scala 3 is 100% gluten-free (it does not cause any stomach cramps :)).

First I was interested what I need to do to get my (emacs) development environment updated/up-and-running. Short answer: Not a lot …

• I installed openjdk-16 and
• sbt 1.4.7 and
• forked the scala3-example-project and
• was able to run it (sbt run)

But when I started to edit the sources metals complained that it only supports 3.0.0-M3 (and not 3.0.0-RC1 (yet)). Got that fixed (by downgrading to 3.0.0-M3) and then moved on to add some tests.

There are already a couple of good options available how to write tests. You can obviously use junit and scalatest. One other mean-and-lean option to write tests for Scala 3 code is to use minittest. It even supports an integration with scalacheck to do some property-based testing.

I used minitest to add tests to the examples project. Enjoy …