The TLDR of this is:
In its current form the indentation based syntax seems a bit inconsistent in how it is handled in scala3 (to me as a beginner of scala3/only maintain a few scala 3 industry products, but 10yrs in scala2). Let’s see if that can be improved!
The long story:
In scala3 I have to remember many different ways of opening a scope, while in scala2 there was one way you always used, braces. Here are some examples of what I need to remember additionally in scala3 for starting new kinds of scopes - When to use:
:(traits, classes, objects, etc)
=(also present in scala2 obv, but could always followed by brace)
How can we make the braceless syntax just as consistent? This post/thread is about seeing if there are ideas to that. Maybe there are already plans in motion to address this?
I get the sense that the indentation based syntax implementation still is kind of experimental, and there should be a much more consistent way of handling it - something that prob could be fixed without breaking backwards compatibility. Right now I am starting to get the old bash shell scripting feelings when I consistently have to go google examples for writing simple control structures.
This said, I have no experience with language implementation and I dont know how complicated it could be to solve - BUT imo it would be hugely positive if we could improve this by picking a way to harmonize the different “begin scope”.
For Example: Would it be possible to make it so
: worked in absolutely all the situations above? Then I wouldn’t have to remember any of the above. It doesn’t have to be
: necessarily, it could also be some other keyword/symbol/something/
begin. Or maybe, unless you opt in to write a single line scope, a new line itself is enough, and we don’t even need any magic symbols at all? (as is currently the case for match expressions and extensions for example)
Would like to write more scala3 without braces but the above is confusing to me
To make it absolutely clear: This is not an anti braceless/anti indentation post. This is about trying to improve the current indentation based syntax.