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

Chris Lattner clattner at nondot.org
Sun Dec 10 15:04:25 CST 2017


On Dec 10, 2017, at 10:04 AM, Paul Cantrell <cantrell at pobox.com> wrote:
>> This is looking less like a protocol by the day. The square-peg grooves in the round hole are getting deeper and more splintery with every revision.
> 
> The flavor of DynamicMemberLookupProtocol with an explicit member requirement sure does _read_ nicely! The fact that Chris left it present but commented out in the proposal suggests that expressing it that way has some intuitive / communicative value.
> 
> This section laying out the reasons why it doesn’t work:
> 
>     https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438#declare-an-explicit-subscript-requirement <https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438#declare-an-explicit-subscript-requirement>
> 
> …reads like a todo list for rounding out protocols and generics.
> 
> So, Chris, question: in the future, maybe circa Swift 6 or 7, is it likely that generalized existentials + some sort of more robust handling of “mutating” in protocols would make the explicit member requirement on DynamicMemberLookupProtocol actually work?

It is possible.   I’m not the best expert on the generics system, but I can’t imagine that it would be a priority in the near term.

-Chris


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


More information about the swift-evolution mailing list