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

Charles Srstka cocoadev at charlessoft.com
Fri Nov 10 17:45:27 CST 2017


> On Nov 10, 2017, at 5:36 PM, Joe Groff <jgroff at apple.com> wrote:
> 
> How `MyObject.foo(_:bar:)` gets implemented is its own business, as far as the compiler is concerned. The compile-time name resolution for the method isn't impacted.
> 
> -Joe

The compile-time name resolution for the method doesn’t happen *at all.* If the method is dynamic, it’s resolved at runtime. The method may or may not even exist; all you know is that the object address, the method name, and a list of the arguments will be passed to a function called objc_msgSend(), which conceptually is remarkably similar to Chris’s dynamicCall().

Charles

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171110/83174da9/attachment.html>


More information about the swift-evolution mailing list