[swift-evolution] Proposal: Add syntactic sugar for iterating over an Optional<SequenceType>

Marco Masser lists at duckcode.com
Wed Dec 16 13:57:28 CST 2015

> This topic has come up in internal discussions several times.  We’ve
> discussed adding new features to for/in loop to handle it, having something
> like “in?” as you suggest:

Glad to hear I didn't miss anything obvious!

etc.  However, the discussion kept coming back to the fact that we have a
> pretty trivial way to express this already:
> I know this is a very minor thing and it can be worked around easily by
> code like this:
> for object in array ?? [] {
>> }
> Thus this isn’t really solving a big problem, and making the language more
> complex isn’t worth it.

 I suspected as much. Thanks for taking the time to look over it!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151216/ee504cf8/attachment.html>

More information about the swift-evolution mailing list