-
Notifications
You must be signed in to change notification settings - Fork 231
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
Add augmented assignment operators to Macaulay2 language #3079
Add augmented assignment operators to Macaulay2 language #3079
Commits on Jan 24, 2024
-
Add augmented assignment operator symbols
One for most flexible binary operators (omitting ones that would introduce ambiguity or give syntax errors) with the same precedence as = (to match C).
Configuration menu - View commit details
-
Copy full SHA for 43e5866 - Browse repository at this point
Copy the full SHA 43e5866View commit details -
Configuration menu - View commit details
-
Copy full SHA for 35838ab - Browse repository at this point
Copy the full SHA 35838abView commit details -
Configuration menu - View commit details
-
Copy full SHA for 434e92d - Browse repository at this point
Copy the full SHA 434e92dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 589b030 - Browse repository at this point
Copy the full SHA 589b030View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8d9c101 - Browse repository at this point
Copy the full SHA 8d9c101View commit details -
Configuration menu - View commit details
-
Copy full SHA for c65c0a9 - Browse repository at this point
Copy the full SHA c65c0a9View commit details -
Configuration menu - View commit details
-
Copy full SHA for 48c9c1d - Browse repository at this point
Copy the full SHA 48c9c1dView commit details -
Configuration menu - View commit details
-
Copy full SHA for eee628f - Browse repository at this point
Copy the full SHA eee628fView commit details -
Identify augmented assignment methods as assignment methods
This way it won't complain when we try to install a function with two arguments.
Configuration menu - View commit details
-
Copy full SHA for ddd951c - Browse repository at this point
Copy the full SHA ddd951cView commit details -
Configuration menu - View commit details
-
Copy full SHA for 802f741 - Browse repository at this point
Copy the full SHA 802f741View commit details -
Configuration menu - View commit details
-
Copy full SHA for 36b087f - Browse repository at this point
Copy the full SHA 36b087fView commit details -
Configuration menu - View commit details
-
Copy full SHA for ae8d559 - Browse repository at this point
Copy the full SHA ae8d559View commit details -
Add augmented assignment operators to operatorAttributes hash table
They're binary and they're flexible, but they're a little different than the members of flexibleBinaryOperators. In particular, we don't want to run installAssignmentMethod on them, which is why we keep them separate from flexibleBinaryOperators.
Configuration menu - View commit details
-
Copy full SHA for 1b0b74e - Browse repository at this point
Copy the full SHA 1b0b74eView commit details -
Provide fallback for user-defined augmented assignment methods
If the method returns the "Default" symbol, then fall back to the usual behavior. This is useful for example for the Python package, where we'd like += to call the __iadd__ method, but only if it exists.
Configuration menu - View commit details
-
Copy full SHA for 870fc93 - Browse repository at this point
Copy the full SHA 870fc93View commit details -
Configuration menu - View commit details
-
Copy full SHA for aff6ef2 - Browse repository at this point
Copy the full SHA aff6ef2View commit details -
Configuration menu - View commit details
-
Copy full SHA for de097cd - Browse repository at this point
Copy the full SHA de097cdView commit details -
Configuration menu - View commit details
-
Copy full SHA for 119da49 - Browse repository at this point
Copy the full SHA 119da49View commit details -
Configuration menu - View commit details
-
Copy full SHA for a6b76e1 - Browse repository at this point
Copy the full SHA a6b76e1View commit details -
Configuration menu - View commit details
-
Copy full SHA for 849ad5a - Browse repository at this point
Copy the full SHA 849ad5aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 5877b8b - Browse repository at this point
Copy the full SHA 5877b8bView commit details -
Add new evaluatedCode member of Code union
This will be used by augmented assignment. The problem was that we first want to check if a user-defined method for augmented assignment is installed, which requires evaluating the code on the left-hand side of the operator. But if we *don't* use a user-defined method (which will be the case most of the time), then we want the original code, since that's what the binary operators expect. The solution is to create a member of the Code union that saves the evaluated code. Then we can evaluate early on but still call the binary operators later if need.
Configuration menu - View commit details
-
Copy full SHA for d7ef94c - Browse repository at this point
Copy the full SHA d7ef94cView commit details -
Refactor augmented assignment so we don't evaluate things twice
Evaluate everything immediately but store it as evaluatedCode for later.
Configuration menu - View commit details
-
Copy full SHA for 7d8107a - Browse repository at this point
Copy the full SHA 7d8107aView commit details