I like the proposal. Having a “magic” protocol isn’t ideal in some ways, but it
seems like the best option for the moment, considering the other restrictions.
The name “DynamicMemberLookupProtocol” is a bit unwieldy, though. What about
something like “SupportsDynamicMemberLookup“ or "SupportsDynamicMembers"? I
know it doesn’t follow the usual protocol naming pattern, but for an empty
“magic” protocol like this, it reads fairly well as a description of the
capabilities of the type:
enum JSON: SupportsDynamicMemberLookup {
// ...
}
Anyway, I like the proposal. The “Supports-“ prefix on the name may be a good
idea, or may not. Either way, the “JSON” example in the proposal shows how this
is useful for more than just bridging to dynamic languages, and is quite
compelling to me.
-BJ
> On Nov 26, 2017, at 11: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