[swift-evolution] Proposal: Introduce User-defined "Dynamic Member Lookup" Types

Chris Lattner clattner at nondot.org
Mon Dec 4 12:58:51 CST 2017


On Dec 4, 2017, at 10:47 AM, Eagle Offshore via swift-evolution <swift-evolution at swift.org> wrote:
> Hi Magnus,
> 
> You raise an excellent point.
> 
> The swift journey has been interesting to watch, for sure.  I do not believe anyone has ever started with a rigidly typed system and then tried to make it more dynamic (Java JVM dynamicInvocation work by Bracha notwithstanding).

C#’s dynamic feature is an example of this.

> Bottom line - I want to see the proof too.  I think everything should be DynamicLookupable - especially library code since the library creator cannot know in advance how his code may be used and it may well want to be bridged from another environment but then I have been doing a lot of bridging of Pharo Smalltalk to native C libraries via FFI lately and I firmly believe bridges need to run both ways.

I think it is possible that you fundamentally misunderstand the proposal.  It does not make it so you can find the members of a type dynamically (as in “reflection").  It allows a type to define custom behavior for otherwise failing lookups.

-Chris



More information about the swift-evolution mailing list