<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 class=""><div><blockquote type="cite" class=""><div class="">On Dec 28, 2015, at 11:10 AM, Thorsten Seitz 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 dir="auto" class=""><div class=""></div><div class="">+1 for being able to use&nbsp;<span style="background-color: rgba(255, 255, 255, 0);" class=""><span class="">cars</span><span class="">.</span><span class="">map</span><span class="">(</span><span class="">make)</span></span></div></div></div></blockquote><div><br class=""></div><div>Check out the thread "<span style="font-family: 'Helvetica Neue';" class="">[Proposal Idea] dot shorthand for instance members</span><font face="Helvetica Neue" class="">” which discusses an idea that gets as close to that as possible. &nbsp;</font></div><div><font face="Helvetica Neue" class=""><br class=""></font></div><div><font face="Helvetica Neue" class="">Something like this is also mentioned in the "Alternatives considered” section of Joe Groff’s&nbsp;“Removing currying func declaration syntax” proposal:&nbsp;</font><a href="https://github.com/apple/swift-evolution/blob/master/proposals/0002-remove-currying.md" class="">https://github.com/apple/swift-evolution/blob/master/proposals/0002-remove-currying.md</a></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="auto" class=""><div class=""><br class="">Am 16.12.2015 um 16:23 schrieb Al Skipp via swift-evolution &lt;<a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a>&gt;:<br class=""><br class=""></div><blockquote type="cite" class=""><div class=""><meta http-equiv="Content-Type" content="text/html charset=utf-8" class=""><div class=""><blockquote type="cite" class=""><div class="">On 16 Dec 2015, at 12:47, Sean Kosanovich 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=""><span style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; float: none; display: inline !important;" class="">As a Groovy user, I really enjoy the shorthand Spread Operator over the Collect Closure (Map is the equivalent in Swift).</span><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;">Consider the following Swift code:</div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">struct</span><span class="Apple-converted-space">&nbsp;</span>Car {</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space">&nbsp;</span>make:<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(112, 61, 170);">String</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">&nbsp; &nbsp;<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space">&nbsp;</span>model:<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(112, 61, 170);">String</span></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;">}</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo; min-height: 13px;"><br class=""></div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space">&nbsp;</span>cars = [<span class="" style="color: rgb(79, 129, 135);">Car</span>(make:<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(209, 47, 27);">"Jeep"</span>, model:<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(209, 47, 27);">"Grand Cherokee"</span>),<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(79, 129, 135);">Car</span>(make:<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(209, 47, 27);">"Dodge"</span>, model:<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(209, 47, 27);">"Challenger"</span>)]</div><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space">&nbsp;</span>makes =<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(79, 129, 135);">cars</span>.<span class="" style="color: rgb(61, 29, 129);">map</span>() { $0.<span class="" style="color: rgb(79, 129, 135);">make</span><span class="Apple-converted-space">&nbsp;</span>}</div></div><div class="" style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px; font-size: 11px; font-family: Menlo;"><br class=""></div><div class="" style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px; font-size: 11px; font-family: Menlo;">&nbsp;</div><div class="" style="font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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; margin: 0px; font-size: 11px; font-family: Menlo;"><br class=""></div><div class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 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;"><div class="">Now consider the same code using a Spread Operator:</div><div class=""><br class=""></div><div class=""><div class="" style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;"><span class="" style="color: rgb(187, 44, 162);">let</span><span class="Apple-converted-space">&nbsp;</span>makes =<span class="Apple-converted-space">&nbsp;</span><span class="" style="color: rgb(79, 129, 135);">cars</span>*.make</div></div></div></div></blockquote></div><br class=""><div class="">I think there is a tension in Swift between its object oriented nature and higher-order functions which leads to a lot of repetition of { $0.property }</div><div class=""><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);"><br class=""></span></div><div class="">In this example:</div><div class=""><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">cars</span><span style="font-family: Menlo; font-size: 11px;" class="">.</span><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(61, 29, 129);">map</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;{ $0.</span><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">make</span><span style="font-family: Menlo; font-size: 11px;" class="">&nbsp;}</span></div><div class=""><span style="font-family: Menlo; font-size: 11px;" class=""><br class=""></span></div><div class=""><div class="">I’d like to write the following, but ‘make’ is a member, not a free function:</div></div><div class=""><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">cars</span><span style="font-family: Menlo; font-size: 11px;" class="">.</span><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(61, 29, 129);">map</span><span class="" style="font-family: Menlo; font-size: 11px;">(</span><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">make)</span></div><div class=""><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);"><br class=""></span></div><div class="">Is anyone else irked by the preponderance of { $0.property } in Swift (or is it just me being grumpy)? Not sure what the solution would be, but I can’t say I’m keen on the suggestion of:</div><div class=""><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);"><br class=""></span></div><div class=""><span class="" style="font-family: Menlo; font-size: 11px; color: rgb(79, 129, 135);">cars</span><span style="font-family: Menlo; font-size: 11px;" class="">*.make</span></div><div class=""><br class=""></div><div class="">It’s too mysterious.</div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=1MXK54sosN3xru3iYcLt0oBZ2w20i49gyogXctgrspcJllYkMx2zN7jpkwwYKNnXX-2Bn4Zop4fyUSq-2BmcR1-2BstADLmxRTvdGJnYSdqjrHMuJPQSWvTkpp-2Fbabszc3XxeXOZe2TCHGOWaxQqjAz6K1bR-2BbpjgmAQO-2FWx4CP7hGaV82qcpm4KWYgAZdhh4NQibFDb31SeddZPTjuJHU4V7yYkDZSOV6X3-2FyH07kLksysLk-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">

</div></blockquote><blockquote type="cite" class=""><div class=""><span class="">_______________________________________________</span><br class=""><span class="">swift-evolution mailing list</span><br class=""><span class=""><a href="mailto:swift-evolution@swift.org" class="">swift-evolution@swift.org</a></span><br class=""><span class=""><a href="https://lists.swift.org/mailman/listinfo/swift-evolution" class="">https://lists.swift.org/mailman/listinfo/swift-evolution</a></span><br class=""></div></blockquote>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=eLFMrKDT8iBxZ-2Fbnk-2BZqvSchNN-2FvYXdceA0T7VxwkAeP8KqAmsCcAXbXH4bZeQIFWqVh2EBVeoe-2Bi-2FwB8O39hRF-2BuBEVC4aZlttGCpwWjkmVpj6GqlBL2py803sSKUzrUQCYmvWVVLdkaGmU2hm-2FNAKGmd0sfe4kQpHcyJAYFjmvdsvxpA5liOpKZ6-2B-2BMSsGEom9cyuSNgjiqp06DLsJKWWNg6zbJZLjR2xZLxtuKeE-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;" class="">
</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>