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

Defining == for ComposedFunction by comparing inner and outer #53853

Open
sunxd3 opened this issue Mar 26, 2024 · 1 comment · May be fixed by #54877
Open

Defining == for ComposedFunction by comparing inner and outer #53853

sunxd3 opened this issue Mar 26, 2024 · 1 comment · May be fixed by #54877
Labels
equality Issues relating to equality relations: ==, ===, isequal

Comments

@sunxd3
Copy link

sunxd3 commented Mar 26, 2024

== for ComposedFunction falls back to egal, c.f.

==(x, y) = x === y

Does it make sense to define something like

function Base.:(==)(cf1::ComposedFunction, cf2::ComposedFunction)
    cf1.inner == cf1.inner && cf2.outer== cf2.outer
end

related PR for Accessors.jl: JuliaObjects/Accessors.jl#146

@nsajko nsajko added the equality Issues relating to equality relations: ==, ===, isequal label Mar 27, 2024
@nsajko
Copy link
Contributor

nsajko commented Mar 28, 2024

I suppose the proposal would be easier to evaluate with a PR that passes the test suite.

NB: if you define ==(::T, ::T), it's required to also define hash(::T, ::UInt)

@jw3126 jw3126 linked a pull request Jun 21, 2024 that will close this issue
@sunxd3 sunxd3 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 22, 2024
@sunxd3 sunxd3 reopened this Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
equality Issues relating to equality relations: ==, ===, isequal
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants