-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Issues with the new x^y
Val lowering
#20882
Comments
cc @stevengj |
Oh, right, I originally had a fallback for If you just define |
There is, of course, an inherent tradeoff here. If you want |
The question is, how often will people actually encounter this? (How often do people define new Is there a way we could define a better fallback method or a better error message? |
(This is not a bug. This is the designed behavior.) |
I think this may be a case where we want method ambiguities. Note that the But there's also the fact that the fallbacks/ambiguity will only work if |
I tend to agree than an ambiguity error might be better here, but see also the discussion in #20530. The basic point is that the goal of (In @malmaud's case, to the extent that this models a real case and not just a contrived example, my expectation is that in any realistic version of this you'd be extending |
Humor me for a moment, and suppose we don't lower Well, if
The key point is that we get expected behavior, but we still leave a path for the specialist: importing To get this behavior, patch here as:
Now, I recognize that this still doesn't give the desired behavior when the user doesn't import
The problem is that For what it's worth, tests seem to pass with my first proposed parser change, except for the new PR 20530 tests because now you'd need to specialize edit: note that in the original example, you get the same method error whether you import |
I worry that the new lowering from 3222749 is going to break people's code in a way that will seem very mysterious to them. Possibly the loss of referential transparency it introduces outweighs the benefits. Consider:
This will be quite confusing to users who aren't aware of this particular optimization.
The text was updated successfully, but these errors were encountered: