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
Warn about change to parenless lambda parens under -Xsource:3 #10320
Conversation
5851193
to
956f58b
Compare
I find this change of the more annoying things about Scala 3, so I can't get enthusiastic about having this warn by default. wdyt about staying silent by default, and warning under The reasoning would be that it's only worth warning by default if the change in question is considered desirable even purely in a Scala 2 context. |
Somewhere I gave the example that changed my mind. Too bad everything is lost on discord. Oh maybe it's in this PR. I would like I will experiment forthwith. If that is feasible, then I would assert that deprecation is correct albeit annoying. Parenless was one of my favorite syntax niches, as attested by my SO answers from 2012. |
@lrytz opinion? |
No fair asking Dad. I'm hoping a |
Maybe @lrytz also has an opinion on nuanced category matching. Matching on category (effectively an enum) is less error-prone than matching the message string. |
For the new ambiguity warning I added
I actually tend to agree with this sentiment. Why do you think |
I considered that the "to silence" suffix is cut/paste advice, but we don't always have the privilege of pasting. On typo, the error message is better with cat. Does that mean all fixed messages should have a cat? I find the example snippet difficult to parse visually because the second colon is a natural place to break. It's a trivial expression that is non-trivial to read. On when to deprecate, I lost the grid, but I think if something is going away, it is deprecated, and errors under |
This is the PR to help the migration story: #10327 In particular So the two funky Scala 3 features that are suddenly indispensable are indentation checking and |
Having had further time to mull it over, I still feel this way. I don't feel we should annoy our users with this unless they have requested migration information. There's probably tons of books and blog posts and SO answers and such that use the parenless syntax; the concept that there was anything wrong with that syntax is entirely new with Scala 3. I don't find the |
I'll detune to avoid annoying people, as I have other ways of doing that. |
4344632
to
2064c89
Compare
2064c89
to
3c2e47d
Compare
I added I almost made it a Also, followed Lukas in emitting the |
3c2e47d
to
99bfa0f
Compare
As you seem to have anticipated, I'm iffy on the need for At minimum, I think we'll need a better description than Whatever warnings |
Edit: I don't care either, so I removed the extra option, one less thing to explain. Also removed my previous comment so I don't have to explain it. Came close to
The following comment is still germane: Someone just asked about something that warns differently under |
99bfa0f
to
c6085a4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I also think in the current form this is good.
The syntax
xs.map { x: Int => x + 1 }
is disallowed in Scala 3.Parenless params are deprecated under
-Xsource:3
, and will error if-Wsource
is added.Without
-Xsource:3
,-Wsource
will warn.The message is, "parentheses are required around the parameter of a lambda".