-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Define ==
for Some
by forwarding to the wrapped value
#52421
Conversation
The tests failing on |
e601b01
to
c122e73
Compare
Co-authored-by: Alex Arslan <[email protected]>
This behavior is reasonable and I wish we had implemented it when adding |
You mean people rely on |
Co-authored-by: Alex Arslan <[email protected]>
I'm not a fan of special-casing |
Why would it not be the right behavior semantically? What behavior do you envision when passing a Using |
I'm not disagreeing with you on that. Where I'm coming from is just that users might have implemented their own types propagating similarly to |
That's a question for the contract of |
We should probably merge #44678 instead since it is a bit more general than this. I am leaning towards doing that now, given the multiple attempts now at it |
That will make This PR really isn't trying to "solve" an invalidation problem for all types in existence at all, but a semantic problem for |
This debate is just a special case of the old discussion at #4648. As you can see no decision has been reached... Another discussion happened at #9381 (comment).
As noted in a thread above, this currently doesn't apply to arrays and tuples: julia> (missing,) == (missing,)
missing So treating The current state of the PR is inconsistent as it doesn't prevent julia> Some([missing]) == Some([missing])
ERROR: MethodError: Cannot `convert` an object of type Missing to an object of type Bool At least @simeonschaub's proposal of using However none of the proposals would be completely consistent with the current docstring for
|
As you wrote in the issue I opened:
Note the |
Test failure is a random timeout - seems unrelated to this PR. Is there anything else needed here to get this merged? |
There seems to be a lot of active discussion here so it seems a bit odd to merge it at this stage, no? |
tbh |
IMO the main concern isn't the inconsistency of By the way, we haven't discussed any concrete use case, which doesn't really help deciding which behavior would be the most useful in practice. |
My concrete use case is that I'd like So without calling |
This PR does not introduce new/unseen semantics:
I can only repeat myself: Other than "propagate |
Yet on this PR: julia> Some(NaN) == Some(NaN)
false
julia> Some([NaN]) == Some([NaN])
false |
Yes, because for the purposes of Now, you might say "why doesn't that apply to |
Alright, since I care about the behavior of the non-missing case more than the cases involving |
It's been a month and I've been told that bumping & pinging people is the socially accepted way. So, @nalimilan, is this PR ready to go with the (now implemented) |
what about instead defining a new seems like all other options in this thread have problems:
|
I don't know what these failures are about - they seem unrelated to these changes. It's been almost another month, so here's another bump. |
Co-authored-by: Lilith Orion Hafner <[email protected]>
Failures are from |
Bumpo Nr. 5 🕺 |
@nanosoldier |
Triage thinks this is reasonable (but that defining methods like this for +, *, etc. would not be good, equality is special in that it is a really basic operation) |
The package evaluation job you requested has completed - possible new issues were detected. |
Nano-soldier looks clean at a glance |
Thank you! |
…value (JuliaLang#52421) The equality of two `Some` depends on the equality of the wrapped value, once the `Some` is unwrapped. --------- Co-authored-by: Alex Arslan <[email protected]> Co-authored-by: Lilith Orion Hafner <[email protected]>
I think this just makes sense - the equality of two
Some
depends on the equality of the wrapped value, once theSome
is unwrapped. This ought to make it a bit nicer to work withSome
.