[swift-evolution] [Pitch] Introduce user-defined dynamically "callable" types

Chris Lattner sabre at nondot.org
Fri Nov 10 19:54:57 CST 2017


> On Nov 10, 2017, at 5:37 PM, Susan Cheng via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Hi all,
> 
> I have few problems with this proposal.
> 
> How we guarantee the arguments type are what we need?
> If we passing the type to the dynamicCall that are not acceptable, what will happened?

Dynamic languages do not provide static guarantees: they check these things at runtime and generally abort/throw on a mismatch.

> Should we always write the dynamicCall as a throwing function to check the precondition?

Sure, that’s totally supported by the proposal.

> Instead of introducing dynamic calls, I would like introducing mirror of instance methods.

I don’t know what that means, but moving forward with this proposal does not preclude solving other people’s problems.  You are welcome to write a proposal for something if you are interested in it.

-Chris



More information about the swift-evolution mailing list