<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class="">On Nov 15, 2017, at 1:38 AM, Andrew Thompson via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt; wrote:<div><blockquote type="cite" class=""><div class=""><meta http-equiv="content-type" content="text/html; charset=utf-8" class=""><div dir="auto" class=""><div class="">Hi Chris,</div><div class=""><br class=""></div><div class="">There are only a few examples in the proposal that demonstrate using dynamic member lookup.</div><div class=""><br class=""></div><div class="">I suppose that some examples will look like this:</div><div class=""><br class=""></div><div class="">let foo: PyRef = ...</div><div class=""></div><blockquote type="cite" class=""><font class=""></font></blockquote><div class="">foo.bar // translates into foo[dynamic: “bar”]</div><div class="">foo.bar.baz // translates into foo[dynamic: “bar”][dynamic: “baz”]</div><div class=""><br class=""></div><div class="">and if we have:</div><div class=""><br class=""></div><div class="">extension PyRef {</div><div class="">&nbsp; &nbsp; var one: Int {</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; return 1</div><div class="">&nbsp; &nbsp; }</div><div class="">}</div><div class=""><br class=""></div><div class="">foo.bar.one // returns 1, because it translates into foo[dynamic: “bar”].one</div><div class=""><br class=""></div><div class="">This to me is hinting that dynamic member lookup will only be applied to one property at a time. In order for it to work on multiple levels, the type being returned by the subscript operation must still conform to DynamicMemberLookup. Is this how you envisioned it to work?</div></div></div></blockquote><br class=""></div><div>The author of the type gets to make that choice. &nbsp;In the case of the Python interop, yes, it will return another PyRef. &nbsp;In the case of a JSON library, that should also return "Self?" so that you can optional chain through an access path.</div><div><br class=""></div><div>That said, there are other potential use cases where you may only want a single level of dynamism. &nbsp;The proposal allows the API author to specify the element type, which means they have flexibility to do what is right for their usecase.</div><div><br class=""></div><div>-Chris</div><div><br class=""></div><br class=""></body></html>