On JDK 17, we can use Java sealed classes

JDK 17 supports enforcement of sealed classes, like so:

public sealed class Shape permits Circle, Square, Rectangle { ... }

I assume this should also bring some performance improvements.

Is there already a discussion of adopting this?

1 Like

Here is a list with JDK related discussions: Issues · scala/scala3 · GitHub

1 Like

It is supported by Scala 2. I thought that was ported to Scala 3, but there is a current PR related to sealed, so apparently I’m not sure. There may be a label for issues about “parity with Scala 2”.

Sometimes it’s fun and educational to do the work twice; other times, it is mentally laborious and does not yield insights that are personally satisfying.

For example, I’m grateful that -Wconf made it to Scala 3, with some differences that are sometimes an improvement. I’m sure that required a degree of fortitude I do not possess.

1 Like

… or, you know, getting paid for it. Your dedication over all these years is absolutely admirable.

6 Likes