<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 2016-02-18, at 00:46, Kevin Ballard 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=""><div class=""><div class="">Alternatively you can write<br class=""></div><div class="">&nbsp;</div><div class="">&nbsp; &nbsp; subviews.lazy.flatMap({ $0 as? NSButton }).find({ $0.state == NSOnState })</div></div></div></blockquote><br class=""></div><div>Just to reiterate my point: I very much prefer the version without any casts. I just think this is much clearer and doesn’t put the burden of thinking about accidental memory and speed overhead (when forgetting the “lazy”) on the caller every time:</div></div><div><br class=""></div><div><div style="margin: 0px; font-size: 11px; line-height: normal; font-family: Menlo;" class=""><span style="font-variant-ligatures: no-common-ligatures" class="">subviews.find(</span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">NSButton</span><span style="font-variant-ligatures: no-common-ligatures" class="">.</span><span style="font-variant-ligatures: no-common-ligatures; color: #bb2ca2" class="">self</span><span style="font-variant-ligatures: no-common-ligatures" class="">, matching: { $0.state == </span><span style="font-variant-ligatures: no-common-ligatures; color: #703daa" class="">NSOnState</span><span style="font-variant-ligatures: no-common-ligatures" class=""> })</span></div></div><div><br class=""></div><div>Also, there’s the goal of Swift being easy to learn. Which line do you think is easier to explain to newcomers?</div></body></html>