I’m fine with the outcome of this discussion not being be personal preferred choice, but I must object to the usefulness of these unscientific polls. The conclusions that can actually be drawn from these polls are severely limited.
First of all, they don’t add anything we don’t already know, since you already tried out these things with your students in more detail.
Second, the only thing they are actually evidence of is that people find :
the most obvious choice.
Third, people voting for one thing is not evidence of actively disliking the other options.
Four, these polls don’t adress the concerns people have raised about the use of :
. In particular, these snippets do not in any way suffer from the issues that have been raised. As I’ve already said multiple times, :
is not an issue in cute poster child Scala syntax.
If these polls was all that was needed to decide this issue, why did we even have this discussion?
A real study would have tried to measure which syntax is easier for people to read and comprehend, not just ask for people’s immidiate subjective reaction to simple examples.
I think the compromise you proposed earlier is the best way to make everyone come out of this feeling that they got something:
In the general case with
is used to start a template body, and in the case of class
, object
, trait
and enum
, :
can be used as a shorthand.
This would adress the very legitimate concerns that has been raised about using :
, while still allowing it where some people feel that a keyword is too long.
The only thing not solved by this solution is how to distinguish type refinements from structural instances. But maybe it’s better to require braces for type refinements anyway, which seems to be the current implementation.