Skip to content

Should allequal use == instead of isequal? #49372

@CameronBieganek

Description

@CameronBieganek

When I worked on the PR to add allequal (#43353), I used isequal instead of ==, because unique and allunique use isequal. However, in retrospect that seems like the wrong choice. It seems to me that users looking for allequal functionality will generally want to compare values with ==. In particular, it is unfortunate that allequal does not follow three-valued logic. So, we currently have the following behavior, which seems undesirable to me:

julia> allequal([NaN, NaN])
true

julia> allequal([missing, missing])
true

julia> allequal([1, missing])
false

I think for most use cases it would be better for those to return false, missing, and missing, respectively.

In the PR discussion, I mentioned the difference between using isequal and using ==, but nobody objected to using isequal. 😅

Unfortunately this would be a breaking change. I would almost consider the failure to propagate missingness a bug, but technically it's not a bug since the docstring does say that comparisons are made using isequal.

Would this qualify as one of those "technically breaking" changes that we could slip into a minor release?

Metadata

Metadata

Assignees

No one assigned

    Labels

    equalityIssues relating to equality relations: ==, ===, isequal

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions