Adopting Scala 3: Why Does It Still Support Deprecated Syntax? #22609
Replies: 2 comments
-
Not all of that is just "backward-compatible". For example, we extensively discussed braces during the design phase of Scala 3, and agreed that braces would remain available indefinitely, because many of us really don't like the braceless syntax. I don't have any intention of going to pure-braceless, pretty much ever -- I find it harder to read in some cases, and IMO the new syntax is cryptic around the edges, and harder to teach. I agree that a strict mode isn't a bad idea when it comes to clearly-"legacy" bits like |
Beta Was this translation helpful? Give feedback.
-
Maybe it could be because Ive already spent 5 years with the new syntax, but for me syntax variations leave no impression on me, even when mixed in the same class - i only see the underlying concepts |
Beta Was this translation helpful? Give feedback.
-
Hey folks,
I'm working at a company with dozens of Scala developers, and we recently started adopting Scala 3. So far, so good—except for the mixing of Scala 2 and Scala 3 syntax in Scala 3 codebases. We assembled a small team who "jumped into the water" and wrote a brand new service in Scala 3. The service works well, but the code ended up being a mess of implicits and givens, classic and braceless syntax, as well as both the old and new conditional syntax.
While I understand that this mix can be useful during the transitional phase from Scala 2 to Scala 3, it’s a disaster for a new project. Scala isn’t the simplest language to learn, and having both Scala 2 and Scala 3 syntax in the same codebase only adds to its complexity.
Fortunately, we discovered two compiler flags—-old-syntax and -no-indent—that help maintain consistency and reduce the syntax variety in our code. However, some features, such as implicits (which have been replaced in Scala 3 by givens and extension methods), cannot be disabled or phased out via a compiler flag.
For someone starting a new project, it makes sense to write pure Scala 3 code. I believe the compiler should offer a "strict" mode that disables backward-compatible Scala 2 syntax entirely.
What do you think?
Beta Was this translation helpful? Give feedback.
All reactions