This one started over at swift-users, with a question on how to deal with 
looping over containers that may be nil.

Imho the beauty of the feature is that it's simple enough to be explained in 
the subject line, but here is the "long" story:

let test: [Int]? = nil

// this is possible now
if let test = test {
        for i in test {
                print(i)
        }
}

// how it could be written with a modified keyword
for i in? test {
        print(i)
}

I've been thinking "in?" had been brought up long ago, but as I haven't found 
such a proposal, I probably confused it with the cancelled plan to write one on 
my own (or I just was to stupid to search ;-).

Syntactic sugar like this is definitely nothing that has priority now, but 
discussing it shouldn't be a big distraction — and if it turns into a proposal 
that as well survives review, it might be even simple enough to act as a 
trigger for me to finally get my hands on some real work for Swift ;-)

- Tino
_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to