[swift-evolution] Proposal: Introduce User-defined "Dynamic Member Lookup" Types
owensd at apple.com
Mon Nov 27 13:43:17 CST 2017
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:
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.
> On Nov 26, 2017, at 10:04 PM, Chris Lattner via swift-evolution <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:
> An implementation of this design is available here:
> The implementation is straight-forward and (IMO) non-invasive in the compiler.
> swift-evolution mailing list
> swift-evolution at swift.org
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution