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

Consider all primary methods when calculating effective dispatch value #107

Merged

Conversation

camsaul
Copy link
Owner

@camsaul camsaul commented Aug 23, 2022

Consider this case:

  • A :toucan isa :can
  • A :toucan isa :bird
  • We have a preference for :bird over :can
  • We have a primary method for :can
  • We have a primary method for :bird

If you invoke the multimethod with dispatch value :bird, it will use the :bird primary method with no next-method.

If you invoke the multimethod with dispatch value :toucan, it will use the :bird primary method with the :can primary method as the next-method.

Thus even though dispatch values :bird and :toucan both use the :bird primary method, their effective dispatch values are not the same; because invoking the method with dispatch value :bird and with dispatch value :toucan is not the same thing.

We need to consider all matching dispatch values when calculating effective dispatch values.

This PR fixes the bug above

@camsaul camsaul merged commit d345683 into master Aug 23, 2022
@camsaul camsaul deleted the consider-all-primary-methods-for-effective-dispatch-value branch August 23, 2022 02:24
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

Successfully merging this pull request may close these issues.

1 participant