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

Inconsistent behavior of the default comparison routine #1074

Open
shirok opened this issue Oct 13, 2024 · 1 comment
Open

Inconsistent behavior of the default comparison routine #1074

shirok opened this issue Oct 13, 2024 · 1 comment

Comments

@shirok
Copy link
Owner

shirok commented Oct 13, 2024

Comparing classes sometimes work:

gosh> (compare <integer> <string>)
-1

But sometimes not:

gosh> (compare <integer> <real>)
*** ERROR: Object #<class <integer>> and #<class <real>> are not comparable
@shirok
Copy link
Owner Author

shirok commented Oct 13, 2024

This has to do the fact that metaclass hierarchy. When (class-of x) and (class-of y) has a subtype relationship, compare calls the superclass's built-in compare callback. Otherwise, it uses the fallback code.

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