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

Adaption feature request: adapt to any protocol of a set of protocols; pick the most specific #244

Open
burnpanck opened this issue Jun 12, 2015 · 0 comments

Comments

@burnpanck
Copy link
Contributor

Some functions need to decide on how to proceed depending on the type of an argument. If adaption is used, then this would usually imply that if the type is not known, then adaption should be attempted. A problem arises if the argument is adaptable to multiple of the expected types. If the function has a clear favourite type, then it can just call adapt with that type and if that fails, continue with the next type. But if the function does not have a clear favourite, then we'd want to get the adapter that is most specific to the incoming argument i.e. the shortest adaption chain. Currently, there is neither an API that allows one to determine the adaption chain length (it's hidden in AdaptionManager._adapt), nor does that function allow to ask for an adapter to a set of protocols.

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