<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 Mar 22, 2017, at 11:41 AM, Ricardo Parada <<a href="mailto:rparada@mac.com" class="">rparada@mac.com</a>> 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="">Agree.<div class=""><br class=""></div><div class="">Another question. If `Bag` does have a static thing called `myStaticThingy` would you refer to it as:</div><div class=""><br class=""></div><div class=""><span style="font-size: 12px;" class=""><font face="Menlo" class="">Bag.Type#myStaticThingy</font></span></div></div></div></blockquote><div><br class=""></div><div>I would expect that to work eventually but I’m not sure if it would be included in the initial proposal or not.</div><br class=""><blockquote type="cite" class=""><div class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><br class=""></div><div class="">?</div><div class=""><br class=""></div><div class=""><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 22, 2017, at 12:37 PM, Matthew Johnson <<a href="mailto:matthew@anandabits.com" class="">matthew@anandabits.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><br class="Apple-interchange-newline">On Mar 22, 2017, at 11:16 AM, Ricardo Parada <<a href="mailto:rparada@mac.com" class="">rparada@mac.com</a>> wrote:</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;"><div class=""><span class="">I see three possibilities:</span></div><div class=""><span class=""><br class=""></span></div><div class=""><span class="">1) # + «</span><font face="Times New Roman" class=""><span class=""><i class="">space</i></span></font><span class="">» +«</span><font face="Times New Roman" class=""><span class=""><i class="">path</i></span></font><span class="">» like this:</span></div><div class=""><span class=""><br class=""></span></div><div class=""><font class="" face="Monaco">let path = # Bag.things[0].name</font></div><div class=""><span class=""><font face="Monaco" class="">bag[path] </font></span></div><div class=""><font face="Monaco" class=""><font class="">bag[</font># <span class=""><font color="#979797" class="">Bag.</font>things[0].name]</span></font></div><div class=""><font face="Monaco" class=""><font class="">bag[#</font> .<span class="">things[0].name]</span><span class=""> </span><font color="#15970a" class="">// Root is inferred as Bag</font></font></div><div class=""><font face="Monaco" class=""><font class="">bag.things[0][</font># <span class=""><font color="#979797" class="">Thing.</font>name]</span></font></div><div class=""><div class=""><font face="Monaco" class=""><font class="">bag.things[0][# </font>.<span class="">name] </span><span class="" style="color: rgb(21, 151, 10);">// Root is inferred as Thing</span></font></div></div><div class=""><span class="" style="font-family: Menlo;"><br class=""></span></div><div class="">2)<span class=""> # + «</span><font face="Times New Roman" class=""><span class=""><i class="">path</i></span></font><span class="">» like this:</span>:</div><div class=""><br class=""></div><div class=""><div class=""><font face="Menlo" class="">let path = #Bag.things[0].name</font></div><div class=""><span class="" style="font-family: Menlo;">bag[path] </span></div><div class=""><font face="Menlo" class="">bag[</font>#<span class="" style="font-family: Menlo;"><font color="#979797" class="">Bag.</font>things[0].name]</span></div><div class=""><font face="Menlo" class="">bag[#</font> .<font face="Menlo" class="">things[0].name] </font><font face="Menlo" color="#15970a" class="">// Root is inferred as Bag</font></div><div class=""><font face="Menlo" class="">bag.things[0][</font>#<span class="" style="font-family: Menlo;"><font color="#979797" class="">Thing.</font>name]</span></div><div class=""><div class=""><font face="Menlo" class="">bag.things[0][#</font>.<span class="" style="font-family: Menlo;">name] </span><span class="" style="color: rgb(21, 151, 10); font-family: Menlo;">// Root is inferred as Thing</span></div></div><div class=""><span class="" style="color: rgb(21, 151, 10); font-family: Menlo;"><br class=""></span></div><div class=""><div class="">3) <span class="">«</span><font face="Times New Roman" class=""><span class=""><i class="">Root</i></span></font><span class="">» </span>+ <span class=""># + </span><span class="">«</span><font face="Times New Roman" class=""><span class=""><i class="">path</i></span></font><span class="">» like this: </span></div></div><div class=""><br class=""></div><div class=""><font face="Menlo" class="">let path = Bag#things[0].name</font></div><div class=""><span class="" style="font-family: Menlo;">bag[path] </span></div><div class=""><font face="Menlo" class="">bag[</font><span class="" style="font-family: Menlo;"><font color="#979797" class="">Bag</font></span>#<span class="" style="font-family: Menlo;">things[0].name]</span></div><div class=""><font face="Menlo" class="">bag[#</font><span class="" style="font-family: Menlo;">things[0].name]</span></div><div class=""><font face="Menlo" class="">bag.things[0][#</font><span class="" style="font-family: Menlo;">name]</span></div><div class=""><font face="Menlo" class="">bag.things[0][</font><span class="" style="font-family: Menlo;"><font color="#979797" class="">Thing</font><span class="" style="font-family: Helvetica;">#</span>name]</span></div></div></div></div></blockquote><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><br class=""></div><div style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class="">I prefer the third option. I don’t think we should go with the first option. Allowing (or requiring) a space seems likely to be confusing. Both the first and the second still have potential to be confusing. If `Bag` has a static property named `things` people could be confused about what `#Bag.things` refers to. If we’re going to use a special sigil it should be positioned such that it eliminates potential for that kind of confusion.</div><br class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><blockquote type="cite" class="" style="font-family: Helvetica; font-size: 14px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"><div class=""><div class="" style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div class=""><div class=""><span class="" style="font-family: Menlo;"><br class=""></span></div><div class=""><span class="" style="font-family: Menlo;"><br class=""></span></div><div class=""><span class="" style="font-family: Menlo;"><br class=""></span></div></div><div class=""><blockquote type="cite" class=""><div class="">On Mar 22, 2017, at 11:47 AM, Matthew Johnson <<a href="mailto:matthew@anandabits.com" class="">matthew@anandabits.com</a>> wrote:</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;"><br class=""><div class=""><blockquote type="cite" class=""><div class="">On Mar 22, 2017, at 10:36 AM, Vladimir.S via swift-evolution <<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class="">On 22.03.2017 17:37, Ricardo Parada wrote:<br class=""><blockquote type="cite" class=""><br class=""><br class=""><blockquote type="cite" class="">On Mar 22, 2017, at 9:30 AM, Vladimir.S <<a href="mailto:svabox@gmail.com" class="">svabox@gmail.com</a>> wrote:<br class=""><br class="">let path = @Bag.things[0].name<br class=""><br class="">bag@path<br class="">bag@.things[0].name<br class=""><a href="mailto:bag@Bag.things" class="">bag@Bag.things</a>[0].name<br class="">bag.things[0]@.name<br class="">bag.things[0]@Thing.name<br class=""></blockquote><br class="">It sounds like the @ character is serving two different purposes which confused me at first.<br class=""><br class="">If I understood correctly, you are using it to get the key path but also to apply the key path to the bag struct and get the corresponding value.<br class=""><br class=""></blockquote><br class="">Yes. And the initial proposal suggest the following syntax accordingly:<br class=""><br class="">let path = Bag.things[0].name<br class="">bag[path]<br class="">bag[.things[0].name]<br class="">bag[Bag.things[0].name]<br class="">bag.things[0][.name]<br class="">bag.things[0][Thing.name]<br class=""></div></div></blockquote><div class=""><br class=""></div><div class=""># makes a lot more sense than @ as a sigil. It follows from #selector and #keyPath. These are the most similar language features right now where the compiler produces special values. I think it’s also worth noticing that values produced by #selector and #keyPath are<span class="Apple-converted-space"> </span><i class="">used</i> in normal ways. There is no magic syntax for their use, just a typed value. If we’re going to make a change we should use # instead of `.` for accessing these special values but we should stick with subscript for use.</div><br class=""><blockquote type="cite" class=""><div class=""><div class="">_______________________________________________<br class="">swift-evolution mailing list<br class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a><br class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></div></div></blockquote></div></div></div></blockquote></div></div></div></blockquote></div></blockquote></div><br class=""></div></div></div></blockquote></div><br class=""></body></html>