You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Cleans up the Variant comparison operations in a few ways:
Ensures all C++17 comparison operations exist, deriving from == and <
Label return values as [[nodiscard]]
Removed old != operator entirely
The last one in particular should've never been separate logic to begin with. I've looked at the operation outputs, and I can't find a single scenario where != and !(==) result in different outputs. I can only assume this was either once the case but has since been fixed, or the original comment was misinformed.
The behavior of using OP_NOT_EQUAL has been used since at least 2016. I assume it was thought that using separate operators for == and != would somehow be beneficial. Otherwise, we wouldn't have a separate OP_NOT_EQUAL in the first place.
By not calling OP_NOT_EQUAL here, we'd be making a first step towards "deprecating" OP_NOT_EQUAL altogether, by not calling it from our own != operations. I think this is good, but it should be discussed.
My memory is totally crumbling imperfect, but I think my rational here was to consider the OP_NOT_EQUAL operator similarly to Python __ne__. So in theory a object could overwrite how OP_NOT_EQUAL was working, and then my_custom_obj1 != my_custom_obj2 would behave differently from [my_custom_obj1] != [my_custom_obj2]
However, like @Ivorforce say, this is something that haven't materialized in the end. And I'm 100% favorable to remove OP_NOT_EQUAL and consider != is always the invert of == 👍
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Variantcomparison by default #112224Cleans up the
Variantcomparison operations in a few ways:==and<[[nodiscard]]!=operator entirelyThe last one in particular should've never been separate logic to begin with. I've looked at the operation outputs, and I can't find a single scenario where
!=and!(==)result in different outputs. I can only assume this was either once the case but has since been fixed, or the original comment was misinformed.