[swift-evolution] Add an ifPresent function to Optional

davesweeris at mac.com davesweeris at mac.com
Mon Mar 14 22:32:09 CDT 2016


Oh! And rereading the thread, I see that Dmitri had mentioned that as well… I must not have seen that message, because he raises some good points that I hadn’t considered. Anyway, sorry, I didn’t mean rehash something that’d already been decided.

I’m still in favor of adding ‘forEach’ over ‘ifPresent’, though… the meaning is as clear (at least to me), and it’s one less function name to remember.

- Dave Sweeris

> On Mar 14, 2016, at 10:12 PM, Jordan Rose <jordan_rose at apple.com> wrote:
> 
> We've talked about this before, so I'm going to link directly to my (negative) response from back then: https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/003697.html <https://lists.swift.org/pipermail/swift-evolution/Week-of-Mon-20151214/003697.html>.
> 
> (The rest of the thread is certainly also relevant, but my past opinion is still the one I most identify with here!)
> 
> Jordan
> 
>> On Mar 11, 2016, at 12:15 , Dave via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>> +1.
>> 
>> I’d go so far as to suggest that maybe Optional should conform to CollectionProtocol, since you can pretty easily think of an Optional as a collection that can’t have more than one element.
>> 
>> - Dave Sweeris
>> 
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160314/8f60d0e4/attachment.html>


More information about the swift-evolution mailing list