<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></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 Dec 15, 2015, at 7:21 PM, Rob Mayoff 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"></blockquote><blockquote type="cite" class="">Dmitri wrote:</blockquote><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><span class=""><div class="">What's the advantage?&nbsp; Why would we want to have a type that is isomorphic to Optional, except that conforms to CollectionType?<br class=""></div></span></div></div></div></blockquote><div class=""><br class=""></div><div class="">My question (apologies if it has been answered already) is: Why isn't Optional a CollectionType, like it is in Scala?</div></div></div></div></div></blockquote><br class=""></div><div>I don't remember the rationale, but it&nbsp;<a href="https://github.com/apple/swift/commit/fad874708e05cff56aec5587a4b0f49cdadc6d11" class="">used to be that way</a>&nbsp;and during the run-up to the Swift 1 release IIRC several members of the Swift team objected to it. &nbsp;That's the answer to Dmitri's question: I have considered that to be off the table, but we could revisit it. &nbsp;</div><div><br class=""></div><div>One cute effect, which might be too cute for some, is that</div><div><br class=""></div><div>&nbsp; if let x = y { &nbsp;... }&nbsp;</div><div><br class=""></div><div>becomes equivalent to</div><div><br class=""></div><div>&nbsp; for x in y { ... }</div><div class=""><br class=""></div>when y is an optional.<div class=""><br class=""><div class="">
-Dave<div class=""><br class=""></div><br class="Apple-interchange-newline">

</div>
<br class=""></div></body></html>