Scala 3 significant indentation

If I may, I would like to try my best to make a constructive argument in favor of making optional braces an experimental feature in Scala 3.0:

Some members of the community obviously have reservations against optional braces, even if they can still be used. As I’ve heard Martin say in presentations: “Scala 3 is when the books will have to be rewritten.” Because of this, features need to get into the language now if they change foundations in such a way that books become outdated when they are added.

Optional braces is by definition not a breaking change. In my humble opinion, what’s important do get into the new books is semantics and things like how givens work. None of this would actually become irrelevant or outdated if and when braces become optional in the language. It would be a quite minor thing to introduce them in a reissue. Books written with brace-syntax would not become outdated and irrelevant just because optional braces is added in 3.0.4 and it says on the internet “Braces are optional now.”

I would go as far as arguing that if the brace-less syntax is really so confusing for people that they merit throwing out all books and documentation, then that in and of itself a huge argument against introducing it.

For this reason, I humbly suggest that optional braces is made an experimental, opt-in feature just like -Yindent-colons. Then the focus can be on the really interesting changes in 3.0, community can try optional braces at their own pace, if there are issues with the new syntax they can be sorted out, and if they are met with enthusiasm from most people, add them then.

Thoughts?

4 Likes