Skip to content
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

Lazily evaluate the right-hand side in augmented assignment #3085

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

d-torrance
Copy link
Member

This is a quick followup to #3079. We hold off on evaluating y in something like x += y until we absolutely know we need it. With this change, ??= would work out of the box if we were to add ?? (or whatever) as a null coalescing operator -- see #1596.

@d-torrance
Copy link
Member Author

Wait, what I said above isn't quite correct -- ??= wouldn't work out of the box for x ??= y if evaluating x raises an error (e.g., a nonexistent key in a hash table)., but it would work out of the box if x is null. It should be an easy change to make it work for errors, though.

@DanGrayson DanGrayson merged commit e27b37c into Macaulay2:development Jan 24, 2024
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants