JuliaSymbolics/Metatheory.jl

Struct-Valued Analysis Cause Infinite Loop

kylebd99 opened this issue · 3 comments

My use case requires a complicated struct for the analysis value. However, when you use a struct, the default equality to compare them is object equality. This causes an infinite loop in the analyze! code because it believes that the analysis value keeps changing.

The fix that I've found is to define a special Egraphs.isequal() function to properly define equality between my structs. This may not be intuitive though for future users, so you may want to update the documentation to include this workaround for struct-valued analyses.

Have you tried using AutoHashEquals on the struct?

Any news on this?

Sorry for the slow response, I just tested it, and autohashequals worked for me! I'm a little hesitant about it because of the effects that it has on storing objects in dicts, but it works great for now. Thanks for putting the effort into this package by the way. It's been really helpful for my research.