Swift: allow easy dynamic dispatch

Originator:christoffer
Number:rdar://17275835 Date Originated:11-Jun-2014 11:25 PM
Status:Open Resolved:
Product:Developer Tools Product Version:6.0 (6A215l)
Classification: Reproducible:Always
 
Summary:
Swift code prefers strong typing and dispatch. By way of ObjC it also allows some amount of dynamic dispatch.

Please consider adding easy dynamic dispatch to Swift, e.g.

func callMethod(object : AnyClass, args: Any...) -> Any?

etc.

It doesn't matter if this many times slower than normal function calls. Just as long as it is there, it enables lots of solutions that otherwise are extremely hard to pull off.

There are many articles showing how to try to *emulate* this in C++.

Please provide at least the level Java has, preferably with a much easier syntax (with java you have to catch a million different types of exceptions - almost)

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!