<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=""><br class=""><div><blockquote type="cite" class=""><div class="">On Dec 3, 2017, at 12:44 PM, Jean-Daniel &lt;<a href="mailto:mailing@xenonium.com" class="">mailing@xenonium.com</a>&gt; wrote:</div><br class="Apple-interchange-newline"><div class=""><div style="font-family: Helvetica; font-size: 13px; 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;" class=""><br class="Apple-interchange-newline"><br class=""><blockquote type="cite" class=""><div class="">Le 3 déc. 2017 à 09:29, Jose Cheyo Jimenez &lt;<a href="mailto:cheyo@masters3d.com" class="">cheyo@masters3d.com</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div dir="auto" class=""><div class=""></div><div class=""><br class=""></div><div class=""><br class="">On Dec 2, 2017, at 11:46 PM, Jean-Daniel &lt;<a href="mailto:mailing@xenonium.com" class="">mailing@xenonium.com</a>&gt; wrote:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><br class=""><div class=""><br class=""><blockquote type="cite" class=""><div class="">Le 3 déc. 2017 à 04:58, Jose Cheyo Jimenez via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; a écrit :</div><br class="Apple-interchange-newline"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">Hi Chris,&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 class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);">@dynamic</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(4, 51, 255);">struct</span><span class=""><span class="Apple-converted-space">&nbsp;</span>PyVal :<span class="Apple-converted-space">&nbsp;</span></span>MemberLookupProtocol<span class=""><span class="Apple-converted-space">&nbsp;</span>{...}</span></div><div class="" style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(4, 51, 255); background-color: rgb(255, 255, 255);">@dynamic</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(4, 51, 255);">struct</span><span class="Apple-converted-space">&nbsp;</span>ParameterSummer :<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(52, 149, 175);">DynamicCallable</span><span class="Apple-converted-space">&nbsp;</span>{...}</div><div class="" style="margin: 0px; line-height: normal; background-color: rgb(255, 255, 255); min-height: 14px;"><br class=""></div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(0, 143, 0); background-color: rgb(255, 255, 255);">// Error: This type needs the @dynamic attribute.</div><div class="" style="margin: 0px; line-height: normal; font-family: Menlo; color: rgb(52, 149, 175); background-color: rgb(255, 255, 255);"><span class="" style="color: rgb(4, 51, 255);">class</span><span class=""><span class="Apple-converted-space">&nbsp;</span>ParamWinter :<span class="Apple-converted-space">&nbsp;</span></span>MyCustomCallableProtocolOrClassOrTypeAlias<span class=""><span class="Apple-converted-space">&nbsp;</span>{...}</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></div></blockquote><div class=""><br class=""></div><div class="">I’m not fond of the idea of an attribute. This introduce redundancy.</div></div></div></blockquote><br class=""><blockquote type="cite" class=""><div class=""><div class=""><div class="">What a declaration means if the attribute is missing ? &nbsp;</div></div></div></blockquote><div class="">Won’t compile?</div><br class=""><blockquote type="cite" class=""><div class=""><div class=""><div class="">What this attribute will mean on an other declaration ?</div></div></div></blockquote>Won’t compile?<div class=""><br class=""></div><div class="">It would be similar to the swift 4 mode where @objc is required in some declarations.&nbsp;</div></div></div></blockquote><div class=""><br class=""></div>No it isn’t.</div><div style="font-family: Helvetica; font-size: 13px; 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;" class="">Like with @NSManagedObject, the very same declaration can exist with or without the @objc attribute depending the context, and the behavior of the function change. Neither is true with the @dynamic proposal.</div></div></blockquote><br class=""></div><div>This is assuming that the protocol is what triggers the compiler to treat this type differently (Current draft implementation).</div><div><br class=""></div><div>Currently in the draft there are 2-3 protocols that give the dynamic behavior to a type. These protocols can be typealias'ed, conformed by other protocols with different names etc.&nbsp;</div><div><br class=""></div><div>________________________</div><div>**someModule.swift***</div><div><br class=""></div><div>public protocol&nbsp;JustAnotherProtocol: DynamicCallable&nbsp;{...}</div><div>________________________</div><div><br class=""></div><div>**myModule.swif***</div><div><br class=""></div><div>struct JSVal:&nbsp;JustAnotherProtocol&nbsp;{...}</div><div>________________________</div><div><br class=""></div><div><br class=""></div><div>How do I know&nbsp;JustAnotherProtocol&nbsp;is dynamic in a git diff?</div><div><br class=""></div><div><div>Having a common sigil like @IamDynamic can make all these declarations explicit. Clearer to the reader. All other related dynamic protocols can share the same umbrella sigil.&nbsp;</div></div><div><br class=""></div><div>Chris added it to the list of potential solutions.</div><div><a href="https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438#reducing-potential-abuse" class="">https://gist.github.com/lattner/b016e1cf86c43732c8d82f90e5ae5438#reducing-potential-abuse</a></div><div><span style="color: rgb(36, 41, 46); font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; orphans: 2; widows: 2;" class=""><br class=""></span></div><div><span style="color: rgb(36, 41, 46); font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; orphans: 2; widows: 2;" class="">"</span></div><div><span style="color: rgb(36, 41, 46); font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; orphans: 2; widows: 2;" class="">We could add an attribute or use some other way to make conformance to&nbsp;</span><code style="color: rgb(36, 41, 46); orphans: 2; widows: 2; box-sizing: border-box; font-family: SFMono-Regular, Consolas, 'Liberation Mono', Menlo, Courier, monospace; font-size: 13.6px; padding: 0.2em 0.4em; margin: 0px; background-color: rgba(27, 31, 35, 0.0470588); border-top-left-radius: 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;" class="">DynamicMemberLookupProtocol</code><span style="color: rgb(36, 41, 46); font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; orphans: 2; widows: 2;" class="">&nbsp;</span><span style="color: rgb(36, 41, 46); font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; orphans: 2; widows: 2;" class="">more visible, e.g.:</span></div><div><div class="highlight highlight-source-swift" style="box-sizing: border-box; margin-bottom: 16px; color: rgb(36, 41, 46); font-family: -apple-system, system-ui, 'Segoe UI', Helvetica, Arial, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol'; font-size: 16px; font-variant-ligatures: normal; orphans: 2; widows: 2;"><pre style="box-sizing: border-box; font-family: SFMono-Regular, Consolas, &quot;Liberation Mono&quot;, Menlo, Courier, monospace; font-size: 13.6px; margin-top: 0px; margin-bottom: 0px; word-wrap: normal; padding: 16px; overflow: auto; line-height: 1.45; background-color: rgb(246, 248, 250); border-radius: 3px; word-break: normal;" class=""><span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">@dynamic</span>
<span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">struct</span> <span class="pl-en" style="box-sizing: border-box; color: rgb(111, 66, 193);">PyVal</span> : <span class="pl-e" style="box-sizing: border-box; color: rgb(111, 66, 193);">DynamicCallable </span>{<span class="pl-k" style="box-sizing: border-box; color: rgb(215, 58, 73);">...</span>}</pre></div><div class="">"</div></div><div><br class=""></div><div><br class=""></div><br class=""></body></html>