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

Make magicast open #290

Open
cgrand opened this issue Nov 17, 2023 · 0 comments
Open

Make magicast open #290

cgrand opened this issue Nov 17, 2023 · 0 comments

Comments

@cgrand
Copy link
Contributor

cgrand commented Nov 17, 2023

Magicasting is the process of generating adapter code when passing an argument whose runtime type is unknown is incompatible with the statically expected type.

This is how for example a Clojure vector is dynamically typed AND can still be passed to any Dart method expecting a List<Foo>.

Adapter code is expected to run in constant time -- if something can't be adapted cheaply it shouldn't be implicitely adapted.

This issue is there to collect thoughts about allowing user to extend magicasting (a bit like one can extend core protocols). Similar precautions to protocol extension should be taken: avoid creating an extension when you don't own one of the type/protocols involved.

An extension that cljd.core could provide could be allowing function to be magicasted to Sink for example.

Generally is more magicasting a good idea (or too magic like the example above) ?
If it's a good idea, should we open it or is it a Pandora's box?

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