[swift-evolution] [Proposal] Remove behavior on AnyObject that allows any obj-c method to be called on it

Andrey Tarantsov andrey at tarantsov.com
Wed Mar 23 15:19:31 CDT 2016

Just thinking out loud — ‘dynamic’ as an attribute on an object, allowing arbitrary method calls that are dispatched dynamically...

let foo: @dynamic AnyObject = Foo()

for thing in things {
    (thing as @dynamic).bar()

Dynamic as a type:

let foo: dynamic = Foo()

for thing in things {
    (thing as dynamic).bar()

Since the dynamic keyword defines a function that goes through runtime dispatch, the same very runtime dispatch that current AnyObject calls go through, it would make sense for the new stuff to be called something like dynamic or dynamic_binding or DynamicObject or whatever.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160324/60a982dd/attachment.html>

More information about the swift-evolution mailing list