[swift-evolution] Auto Unwrapping Of Optionals

David Sweeris davesweeris at mac.com
Sun May 1 00:11:03 CDT 2016


> On Apr 29, 2016, at 1:23 PM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
> 
> This is definitely something I’m hoping to see as well, alongside more intelligent handling of the is keyword, as currently Swift doesn’t handle the following either:
> 
> 	if foo is SomeType { /* foo could be safely used as SomeType here, but currently is not */ }
> 
> Hopefully someone more familiar can weigh in, as it seems like something I expect to be on the way but perhaps has been delayed in case any further changes to the type system were required?

This can be handled with the if-let syntax:
if let foo = foo as? SomeType { … }
although I think your idea is more readable.

- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160501/a97060e6/attachment.html>


More information about the swift-evolution mailing list