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

Chris Lattner clattner at nondot.org
Mon Nov 27 15:26:23 CST 2017


Thanks David,

-Chris

> On Nov 27, 2017, at 11:43 AM, David Owens <owensd at apple.com> wrote:
> 
> I like the proposal. I think it’s simple and straight forward and provides some really nice ergonomics for working with dynamic data.
> 
> I appreciate the option to change the names too.
> 
> If I understand it correctly, you could also call “add_trick” via:
> 
> dog.addTrick("Roll over");
> 
> And simply update the subscript implementation to provide additional name look-ups. Cool!
> 
> And I like that the DynamicCallable provides the next level that I want to make the API more “Swift-like” and make use of named parameters:
> 
> dog.add(trick: "Roll over");
> 
> Or maybe more appropriate:
> 
> dog.addTrick("Roll over”, favorite: true);
> 
> I didn’t look at the implementation details, but I think the overall approach. I’d like it better if we have provisions to create these types of tools outside of the compiler, but that’s another topic.
> 
> -David
> 
>> On Nov 26, 2017, at 10:04 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> I’d like to formally propose the inclusion of user-defined dynamic member lookup types.
>> 
>> Here is my latest draft of the proposal:
>> https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438 <https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438>
>> https://github.com/apple/swift-evolution/pull/768
>> 
>> An implementation of this design is available here:
>> https://github.com/apple/swift/pull/13076
>> 
>> The implementation is straight-forward and (IMO) non-invasive in the compiler.
>> 
>> -Chris
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20171127/77f322fa/attachment.html>


More information about the swift-evolution mailing list