-
Notifications
You must be signed in to change notification settings - Fork 21
2.13: confusing error when using infix for nullary method #11461
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Why would you apply unit value to a method that takes no params? The message makes perfect sense if you have drunk no kool-aid. If someone is confused, maybe |
how else would i call a nullary method like this in no-dots/dsl syntax? |
@ritschwumm That is called postfix, not infix. |
calling |
That was a bug. The spec: "The right-hand operand of a left-associative operator may consist of several arguments enclosed in parentheses...". There is no deprecation, although the feature doc is persuasive: "Postfix notation is preserved for backward compatibility only. Historically, several DSLs written in Scala need the notation."
|
so dotless DSL syntax is effectively dead now, except when you are lucky and all methods involved take exactly one parameter in one parameter list? maybe it should be removed altogether then, simplifying the grammar some more... |
Alternatively, someone could propose a new feature, "unit value discard," as vengeance for "value discard," to apply just for this case, discarding unit value when no value is expected in a param list. (Note that no value is not Meantime, the PR avoids advanced DSL gymnastics and simply suggests:
|
Unit value discard is proposed at scala/scala#7973 |
If you want to design a DSL that allows you to write this, you still can:
Only now it's actually consistent. Now only |
LOL Som already improved the description on scala/scala#7684, I have improved the title and also made the change in dem Release-Notes auf GitHub 🇩🇪 |
I see the unimproved title was translated directly in the foreign press. Now I wish I had come up with a good pun for it. On gitter yesterday, I said, In loco parenthesis. |
Scala 3 is headed that direction, see scala/scala3#4311 and the |
In 2.12:
In 2.13:
The text was updated successfully, but these errors were encountered: