JuliaDiff / JuliaDiff/ChainRulesCore.jl

Make `==` , `hash` not depend on canonicalize?

Open
#231 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Structural Tangent
Dominant language
Julia
Stars
267
Forks
66
PR merge metrics
No merged PRs in 30d

Description

https://github.com/JuliaDiff/ChainRulesCore.jl/pull/230
made == and hash use canonicalize.
https://github.com/JuliaDiff/FiniteDifferences.jl/pull/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 https://github.com/JuliaDiff/ChainRules.jl/issues/285#issuecomment-708457503

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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading PR #230 and the linked ChainRules.jl issue comment to understand the canonicalize-based equality and hash change. Compare the proposed propertynames/fieldnames and iszero/Zero options, then determine consistent behavior for ChainRulesCore; no file or test is named, so the relevant equality and hash tests must first be identified.

Written by the indexing model from the issue text.

Assessment

Tech stack
julia
Domain
tooling
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.