<div dir="ltr">It doesn't bother me, because I read it as an additional constraint on the `for` loop rather than an operation being done on the enumerated sequence. That is,<div><br></div><div> for x in y where x > 2 { }</div><div><br></div><div>is fairly consistent with </div><div><br></div><div> if let x = y where x > 2 { }</div><div><br></div><div>And you wouldn't expect to be able to do "let x = y where x > 2".</div><div class="gmail_extra"><br clear="all"><div><div><div dir="ltr"><div>Jacob Bandes-Storch<br></div></div></div></div>
<br><div class="gmail_quote">On Sat, Dec 19, 2015 at 8:22 PM, Charles Constant via swift-evolution <span dir="ltr"><<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Thanks Charles ,<div><br></div><div>I know it's possible to do the same thing with filter. The syntax I drew attention to would be an alternate way. </div><div><br></div><div>My only rationale is that, if it works in one place, it ought to work everywhere. The redundancy bothers me too, but since the concept exists, we may as well allow it everywhere. Otherwise, it's still redundant in a "for" loop (maybe performance is better, but that could be optimized?), but also inconsistent because it seems intuitively like it ought to create a subset whereas in reality it is illegal.</div><div><br></div><div>Does it bother anyone else, or am I nitpicking?</div></div><div><div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Dec 19, 2015 at 7:52 PM, Charles Srstka <span dir="ltr"><<a href="mailto:cocoadev@charlessoft.com" target="_blank">cocoadev@charlessoft.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word"><div><div><blockquote type="cite">On Dec 19, 2015, at 9:43 PM, Charles Constant via swift-evolution <<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a>> wrote:<br></blockquote><div><blockquote type="cite"><br><div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">I noticed several weeks ago that the following is illegal:<br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important"> let new_arr = el in arr where<span> </span></span><a href="http://el.is/" style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px" target="_blank">el.is</a><span style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;float:none;display:inline!important">_foo // illegal</span><br style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">I assumed it would work because it's consistent with the filtering that exists in a "for" loop, i.e.:</div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"> for el in arr where<span> </span><a href="http://el.is/" target="_blank">el.is</a>_foo // legal<br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="font-family:Helvetica;font-size:12px;font-style:normal;font-variant:normal;font-weight:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Is this "new proposal" material? I thought I would check in case it's already on the roadmap, or inherently wrong.</div></div></blockquote></div><br></div></div><div>I believe what you want is already possible via the “filter” method.</div><span><font color="#888888"><div><br></div><div>Charles</div><div><br></div></font></span></div></blockquote></div><br></div>
<img src="https://u2002410.ct.sendgrid.net/wf/open?upn=P-2BsYbBZHRBuLDBJaL4DIKDNfkkjpROowTyRAObV11qzRaqAqbqp979hECJXGD8pFlX7-2F-2B-2FT-2FSlL-2F5StUcFiVW7HkjK1QDKMmQJiSJzzlaiNPIv4-2F6x13G0c5mGIZX2vZwi9R5RwLYtEe5Y-2FRhRTVadZARgWuBd8hYksyur6TdExBuEUDGCqvrte5a-2B4RtDleg4dOIkfnpvTqwMEgftmfM1mTNFITw-2Ful6vdxVxFYrPk-3D" alt="" width="1" height="1" border="0" style="min-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">
</div></div><br>_______________________________________________<br>
swift-evolution mailing list<br>
<a href="mailto:swift-evolution@swift.org" target="_blank">swift-evolution@swift.org</a><br>
<a href="https://lists.swift.org/mailman/listinfo/swift-evolution" rel="noreferrer" target="_blank">https://lists.swift.org/mailman/listinfo/swift-evolution</a><br>
<br></blockquote></div><br></div></div>