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

Move != to function instead of method #106

Merged
merged 2 commits into from
Jan 3, 2024
Merged

Move != to function instead of method #106

merged 2 commits into from
Jan 3, 2024

Conversation

saulshanabrook
Copy link
Member

@saulshanabrook saulshanabrook commented Dec 27, 2023

This PR changes how you emit the != egglog function. Previously, you would use the __ne__/x !=y method to create it; with this PR, it is moved to a standalone function ne(x).to(y).

This allows custom classes to override __ne__ to support custom expressions, like how, on arrays, it would return an array of booleans. It also unifies it with the eq function, which behaves similarly.

This is a breaking change, and I could have instead preserved the __ne__ behavior on existing classes and allowed a custom operator on override. This would have been backward compatible, but I thought it was slightly more subtle. Also, for classes that have a custom __ne__, they might also want to emit the builtin != function, so we would need another way of creating that as well.

Happy for any feedback on this approach!

@saulshanabrook saulshanabrook merged commit 4565f4d into main Jan 3, 2024
11 checks passed
@saulshanabrook saulshanabrook deleted the qol-bugs branch January 3, 2024 19:03
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.

1 participant