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

Add no-applicable-method that gets called if there's no matching primary method #69

Open
camsaul opened this issue Jun 11, 2021 · 4 comments
Labels
enhancement New feature or request

Comments

@camsaul
Copy link
Owner

camsaul commented Jun 11, 2021

CLOS has this.

The default could just throw an Exception about there not being an impl like it does anyway. But maybe there's a use-case for customizing this behavior.

@camsaul camsaul added enhancement New feature or request good first issue Good for newcomers and removed good first issue Good for newcomers labels Jun 11, 2021
@camsaul
Copy link
Owner Author

camsaul commented Jun 11, 2021

I guess this might just have to be a plain old Clojure multimethod since it would be a low-level thing relative to the rest of Methodical. Not sure what is should dispatch off of... the multimethod var? How does this information get to the place where we dispatch? What happens for programmatically-defined methods? Maybe this should actually just be part of the options passed to defmulti (etc.) and then pass those along when we build the :dispatcher

@camsaul
Copy link
Owner Author

camsaul commented Sep 9, 2022

I'm not really 100% sure why I wipe her this issue and how this is really different from just writing a :default method. I'll have to try to remember.

@camsaul
Copy link
Owner Author

camsaul commented Sep 9, 2022

@camsaul
Copy link
Owner Author

camsaul commented Sep 9, 2022

I guess the only possible difference here instead vs writing a :default method would be that it wouldn't be visible as a next-method to anyone else. So this could be useful if you wanted to have some sort of more specific error message if there is no matching method than the default.

This differs a bit from what CLOS uses it for. According to CLOS-ERROR-CHECKING-ORDER

It was clearly intended that the call to no-applicable-methods be for value, rather than for effect. It just wasn't actually specified that way anywhere.

It seems like :default fits the "call for value" usage. So the main use case here would probably be for effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant