<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi Chis,&nbsp;<div class=""><br class=""></div><div class="">Thank you for pushing this forward.</div><div class=""><br class=""></div><div class="">My only comment is that on the declaration side it would be great to also have an attribute to communicate that compiler magic is happening.</div><div class=""><br class=""></div><div class="">Currently it is surprising that a regular looking protocol is providing me so much power.</div><div class=""><br class=""></div><div class="">Suggestions:&nbsp;</div><div class=""><br class=""></div><div class=""><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@dynamic</div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><span style="color: #0433ff" class="">struct</span><span style="color: #000000" class=""> PyVal : </span>MemberLookupProtocol<span style="color: #000000" class=""> {...}</span></div><div style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);" class="">@dynamic</div><div style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);" class=""><span style="color: #0433ff" class="">struct</span> ParameterSummer : <span style="color: #3495af" class="">DynamicCallable</span> {...}</div><div style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;" class=""><br class=""></div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0); background-color: rgb(255, 255, 255);" class="">// Error: This type needs the @dynamic attribute.</div><div style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);" class=""><span style="color: rgb(4, 51, 255);" class="">class</span><span style="color: rgb(0, 0, 0);" class=""> ParamWinter : </span>MyCustomCallableProtocolOrClassOrTypeAlias<span style="color: rgb(0, 0, 0);" class=""> {...}</span></div></div><div class=""><br class=""></div><div class="">By requiring @dynamic (Or other attribute name), people can know that this is a compiler dynamic declaration and not just some random protocol whose name starts with Dynamic*. :)</div><div class=""><br class=""></div><div class="">@NSManagedObject is another example I like from Core Data.</div><div class=""><a href="https://useyourloaf.com/blog/core-data-code-generation/" class="">https://useyourloaf.com/blog/core-data-code-generation/</a></div><div class=""><br class=""></div><div class="">- Cheyo</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Nov 28, 2017, at 8:35 PM, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 27, 2017, at 6:21 PM, Brent Royal-Gordon &lt;<a href="mailto:brent@architechies.com" class="">brent@architechies.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><meta http-equiv="Content-Type" content="text/html; charset=utf-8" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><div class=""><blockquote type="cite" class=""><div class="">On Nov 25, 2017, at 3:16 PM, Chris Lattner via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px;">Just to talk to myself a bit here, but I’ve come to realize that the right design really is to have a simple empty marker protocol like this:</div></div></blockquote><br class=""></div><div class="">If you're reaching this point. why have a marker protocol at all? Why not treat `subscript(dynamicMember:)` specially on any type that has it, or have an `@dynamicMember subscript(_:)` attribute, or introduce an entire new `dynamicMember(_:)` declaration?</div></div></div></blockquote></div><br class=""><div class="">We’ve had a lot of discussions over the years about how to balance simplicity vs power, implicitness vs explicitness, intentionality vs accidental behavior, etc. &nbsp;For example, in very early discussions about Swift generics, some folks where strong proponents of protocol conformance being fully implicit: satisfying all the requirements of a protocol meant that you conformed to it, even if you didn’t explicitly “inherit” from it.</div><div class=""><br class=""></div><div class="">This is obviously not the design we went with over the long term, and I’m glad we didn’t. &nbsp;That said, if we did, then all of the “ExpressibleBy” protocols wouldn’t &nbsp;need to exist: we’d probably just say that it was enough to implement the requirements to get the behavior and elide the protocol declaration entirely.</div><div class=""><br class=""></div><div class="">I think that DynamicMemberLookup requiring conformance is the same thing: it makes it explicit that the behavior is intentional, and it allows somewhat better error checking (if you conform to the protocol but don’t implement the (implicitly known) requirement, you DO get an error). &nbsp;That said, this is just my opinion. &nbsp;</div><div class=""><br class=""></div><div class="">Do you feel strongly enough about this that you’d like to make a strong argument for changing the behavior?</div><div class=""><br class=""></div><div class="">-Chris</div><div class=""><br class=""></div></div>_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class="">https://lists.swift.org/mailman/listinfo/swift-evolution<br class=""></div></blockquote></div><br class=""></div></body></html>