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

support more predicates, like issetequal #4

Open
aplavin opened this issue Sep 8, 2024 · 2 comments
Open

support more predicates, like issetequal #4

aplavin opened this issue Sep 8, 2024 · 2 comments

Comments

@aplavin
Copy link

aplavin commented Sep 8, 2024

Currently, the predicate (== or another) is simply propagated and used to compare all parts of the object.
It would be useful to also support stuff like whynot(issetequal, a, b) for collections. It should point to an element in one collection but not the other, and potentially find the "closest" match in the other collection to show differences there (using ==).

Do you think this is feasible to implement?

@jw3126
Copy link
Owner

jw3126 commented Sep 8, 2024

Feasible yes, probably needs a big refactoring if we want to avoid complexity hell. If you are still interested, happy to discuss ideas.

@jw3126
Copy link
Owner

jw3126 commented Sep 8, 2024

Roughly we could do something like this. We allow the comparison function to not only return true, false but a reason why something is false. E.g. cmp(x,y)::Union{Bool, AbstractDiagnostic}. For instance AbstractDiagnostic could be a struct that tells two sets are not equal and holds the closest element.

We also add another indirection resolve_cmp that maps issetequal to such a comparison function with a custom diagnostic.

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

No branches or pull requests

2 participants