Closed apkille closed 1 month ago
Is it sufficient to just skip :metadata
in propsequal?
Also, jeez, how did this not pop up in the past... It looks like a pretty bad issue.
Is it sufficient to just skip
:metadata
in propsequal?
That would be the most straightforward fix IMO, although I wasn't sure if this is the most efficient fix and whether or not we should consider a better way of evaluating equality. Perhaps this is OK for now. This is somewhat related, but it might also be good to clean up the withmetadata
macro in the process, as it's pretty ugly at the moment. We could maybe use the capture features from MacroTools.jl or MLStyle.jl. Let me know your thoughts.
Also, jeez, how did this not pop up in the past... It looks like a pretty bad issue.
I was surprised about this too, but it's most likely because the past few PRs have not dealt with predefined objects like basis states, which is how I encountered the issue.
I would suggest a separate PR for the simple fix for this issue, which can be merged quickly, and then potentially a future PR that simplifies the macro, if that is reasonably easy to do with the tools you had suggested. There is also https://github.com/Roger-luo/Expronicon.jl which can be useful for this type of work.
OK, that sounds good.
Describe the bug 🐞
The macro
@withmetadata
adds a metadata property to a defined struct. This becomes an issue whenpropsequal
is called because this function evaluates equality of two symbolic objects by evaluating the equality of their properties. But we shouldn't care about metadata when evaluating equality, as that only contains information about the cached results fromexpress
.Minimal Reproducible Example 👇