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

== not defined for IndexLens #144

Open
sunxd3 opened this issue Mar 20, 2024 · 4 comments
Open

== not defined for IndexLens #144

sunxd3 opened this issue Mar 20, 2024 · 4 comments

Comments

@sunxd3
Copy link

sunxd3 commented Mar 20, 2024

We are trying to update Turing.jl to using Accessors.jl in sync with BangBang (TuringLang/AbstractPPL.jl#91)

I noticed that == for IndexLens is not defined, (c.f. Setfield's definition).

Are there reasons this is removed (or just not ported)?

@jw3126
Copy link
Member

jw3126 commented Mar 20, 2024

Thanks a lot for bringing this up. Hash and equality should be defined in the same ways as in Setfield. The only exception are compositions, which use Base.\circ.

@sunxd3
Copy link
Author

sunxd3 commented Mar 22, 2024

Just started a PR at #146.

For equality comparisons between ComposedOptic, I kept the original definition. @jw3126 can you clarity why do we need circ (or opcompose) in this case?

@jw3126
Copy link
Member

jw3126 commented Mar 22, 2024

Just started a PR at #146.

For equality comparisons between ComposedOptic, I kept the original definition. @jw3126 can you clarity why do we need circ (or opcompose) in this case?

julia> using Accessors

julia> Accessors.ComposedOptic
ComposedFunction

So ComposedOptic is just an alias and owned by Base. So we should not commit type piracy and overload hash or equality for it. Does this answer your question?

@sunxd3
Copy link
Author

sunxd3 commented Mar 22, 2024

Yes, perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants