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

Composed models tool #92

Open
camsaul opened this issue Jan 18, 2023 · 0 comments
Open

Composed models tool #92

camsaul opened this issue Jan 18, 2023 · 0 comments

Comments

@camsaul
Copy link
Owner

camsaul commented Jan 18, 2023

The following was written as a stream of consciousness in a notes app. I'll have to update it to something coherent later.

It would be nice if you could just derive a new keyword from both the original models and have things mostly JUST WORK. Maybe you'd have to prefer a things like one table name method over the other but that's it? I think you'd probably have to use a namespaced model for that stuff tho.

A tool for defining "composed" models or something could be useful. If we're just doing prefer-method! for stuff we need to have something for tools to hook into without us knowing about them. So maybe we can have a do combination multimethod for tools to hook into like on-compose-models or something.

Maybe the tool is a general "prefer" hook that can register a preference for all the relevant multi methods.

Maybe prefer-method! is not the right way to do it, since that would affect a bunch of other stuff possibly unintentionally and it would mean we couldn't do another composition in reverse order.

New idea: we'll derive new keywords for all the models were composing, with each one derived from the next so they are ordered the way you asked without hook shenanigans.

The ordering magic doesn't work since the original methods are still not ordered. I think our only option is some sort of on-compose hook. See also camsaul/methodical#127

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant