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

Faster type equivalence testing #1007

Open
shirok opened this issue Mar 24, 2024 · 1 comment
Open

Faster type equivalence testing #1007

shirok opened this issue Mar 24, 2024 · 1 comment

Comments

@shirok
Copy link
Owner

shirok commented Mar 24, 2024

Simple types and aggregate types with the same constructor arguments can be compared with eq? so it's fast, but there are cases that non-eq? types are equivalent, e.g. (</> <integer> <string>) and (</> <string> <integer>). We can test equivalence with (and (subtype? X Y) (subtype? Y X)) but it can be slow.

Adding equivalence test callback to <type-constructor-meta> may help testing equivalence fast.

Internally we can sort the elements of choices (the order shouldn't matter as type), so that we can compare them faster.

@shirok shirok changed the title Type equivalence Faster type equivalence testing Mar 24, 2024
@shirok
Copy link
Owner Author

shirok commented Oct 13, 2024

Sorting types isn't that straightforward. We couldn't comapre pointers of <type> instances, for there can be more than one instances of a type. We need to devise a consistent ordering including aggregate types.

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

1 participant