[swift-evolution] Proposal Sketch: simplify optional unwrapping syntax

Chris Lattner clattner at apple.com
Sat Dec 19 11:01:54 CST 2015


> On Dec 11, 2015, at 8:19 AM, Jeff Kelley via swift-evolution <swift-evolution at swift.org> wrote:
> 
> I’ve had similar ideas to this. Instead of ditching the if let syntax altogether, another approach would be to use the existing name if no new name is given, so that this code:
> 
> 	if let foo = foo { /* use foo */ }
> 
> could become this code:
> 
> 	if let foo { /* use foo */ }
> 
> In both cases, foo is non-optional inside the braces. If you gave it another name with the if let syntax, that would work as it does today.

Hi Jeff,

This is commonly requested - the problem is that while it does help reduce boilerplate, it runs counter to the goal of improving clarity.

-Chris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151219/47d75c20/attachment.html>


More information about the swift-evolution mailing list