[swift-evolution] [Pitch] Introduce user-defined dynamically "callable" types
Joe Groff
jgroff at apple.com
Fri Nov 10 14:57:10 CST 2017
> On Nov 10, 2017, at 12:37 PM, Charles Srstka <cocoadev at charlessoft.com> wrote:
>
>> On Nov 10, 2017, at 12:04 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>>
>> I don't like the idea of some calls having wildly different semantics from others; it's difficult enough to tell what exactly a call might be doing already. Since we also lack the more obvious static "Callable" protocol idea to give even well-typed call syntax to user-defined types, this also seems like it'd be easily abused for that purpose too.
>
> We already have that though, with the Objective-C bridge. How is the proposed behavior here more wildly different than the semantics of non- at objc, @objc, and @objc dynamic calls?
The language semantics aren't any different for non- at objc or @objc calls. The dispatch mechanism is an implementation detail. `dynamic` admits the possibility of late binding to change the method implementation dynamically, but doesn't change the type system behavior of the method, or radically change the implementation mechanism; it's still ultimately an indirect call, it doesn't turn your argument list into a dictionary that can be arbitrarily interpreted by user code.
-Joe
More information about the swift-evolution
mailing list