-
Notifications
You must be signed in to change notification settings - Fork 1.1k
betterFors trailing map
elimination can change the resulting type
#21804
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
I believe this one must be considered an intended source breakage. That for comprehension collapses to just |
One possibility is to do the reduction from It's a bit messier than what we have now. Not sure whether we want to do this anyway in order to avoid the extensive breakages in the open CB. |
and also you can detect if elimination would change the type of expression, issue a migration warning, and suggest workaround like |
@odersky I proposed a similar transformation to what you're describing as an addition to the SIP-62 here: scala/improvement-proposals#79 (comment) (and opened an extremely silent pre-SIP https://contributors.scala-lang.org/t/pre-sip-sip-62-addition-proposal-better-effect-loops-with-for-comprehensions/6759) |
It's obviously not an implementation detail, since it yields a different result type. 😉 It's at least a concern that could be brought back to the SIP committee for reconsideration. |
@sjrd Right. If we don't consider this a bug, but simply a behavior change, then you're right. |
I think for all intents and purposes, this should be considered a bug. We can't simply break half a dozen projects and then reconsider later. |
If it's a bug, it's a spec bug, because AFAICT the implementation is directly following the SIP. So changing it needs to back to SIP anyway. This is exactly the point of having two stages to the process: so that the implementation phase can inform back into the design of the approved spec proves to be impractical. |
I drafted the changes to the SIP: scala/improvement-proposals#99 |
curious if this is being worked on? |
I intend to and there is a draft implementation, but I'm waiting for the SIP committee's decision on the new design. |
@lihaoyi I believe you're the manager of SIP-62 — do you have any updates for Kacper? |
The decision from the last meeting is to go ahead with design changes during experimentation, and we will review them at the end before turning it from experimental to stable |
Compiler version
3.6.1-RC1-bin-20241017-59b67fc-NIGHTLY
Minimized code
Output
without
betterFors
enabled, this code compiles successfully.Expectation
The type of the
for
-comprehension should not be changed after enabling thebetterFors
language extension.The text was updated successfully, but these errors were encountered: