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

Make == , hash not depend on canonicalize? #231

Open
oxinabox opened this issue Oct 14, 2020 · 0 comments
Open

Make == , hash not depend on canonicalize? #231

oxinabox opened this issue Oct 14, 2020 · 0 comments
Labels
Structural Tangent Related to the `Tangent` type for structured (composite) values

Comments

@oxinabox
Copy link
Member

#230
made == and hash use canonicalize.
JuliaDiff/FiniteDifferences.jl#111 does the same to FiniteDifferences.to_vec
this is a problem if ever we are having fields that for example match to the properties rather than the fields.
This was brought up in JuliaDiff/ChainRules.jl#285 (comment)

One option might be to introduce a Maybe we should have a canonicalize(x, mode=propertynames) or just always use propertynames rather than fieldnames

But specifically for these cases:
For isequals instead we should probably check that any fields not in both are iszero.
For hash we might be able to drop any fields that are iszero or maybe just any that are Zero.

to_vec is harder and not for this repo.

@oxinabox oxinabox added the Structural Tangent Related to the `Tangent` type for structured (composite) values label Oct 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Structural Tangent Related to the `Tangent` type for structured (composite) values
Projects
None yet
Development

No branches or pull requests

1 participant