-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Bind in-place update operators (e.g. +=) in Python #8683
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
Conversation
|
Converting to draft as my attempted workaround for the double-updates issue broke something else. Python |
|
Looks like upstream LLVM broke... something. Seeing the same errors in #8684 |
|
During the dev meeting, we discussed an alternative implementation strategy where |
d54ff7d to
f0f7baf
Compare
|
I attempted the alternate implementation and it seems to work, perhaps even more cleanly than before! |
|
MSVC doesn't like a template... diagnosing |
85a8132 to
d2be2ee
Compare
src/Func.h
Outdated
| } | ||
|
|
||
| /** What are the arguments to the function? */ | ||
| const std::vector<Expr> &get_args() const { |
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.
Two thoughts:
- Our getters don't normally have
get_ - This should be explicit about not expanding implicit vars. Here's a test case:
f[_] += g[x, y]I think it probably works because_will be unexpanded on both sides for the check.
So maybe rename the member to args_, the method to args(), and add a note to the comment that any implicit vars aren't expanded? Or maybe it would be better to rename the method to unexpanded_args, or raw_args or something like that. There should be something to make sure callers stop and think about implicit vars for a second.
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.
Yeah, the get_ prefix was to avoid renaming the member. If I use the raw_args name, I should kill two birds with one stone. I'll add the test case, too.
This enables inference of units (and types) for pure definitions in reduction-y update stages.
Fixes #8661