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
> <[email protected]> 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://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
> [email protected]
> https://lists.swift.org/mailman/listinfo/swift-evolution
_______________________________________________
swift-evolution mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-evolution