[Proposal] implicit `if let`

Hi,

We usually do this

If let foo = foo {
// bar
}

What if the compiler would understand

If let foo {
// bar
}

As if the `= foo` would be there?

I’d find it great syntactic sugar.

This has been proposed and rejected a few times, actually. You can see it in the Swift-Evolution “Commonly Rejected Changes” document here: https://github.com/apple/swift-evolution/blob/master/commonly_proposed.md

-BJ

···

On Oct 11, 2017, at 12:29 PM, Manuel Carrasco Molina via swift-evolution <swift-evolution@swift.org> wrote:

Hi,

We usually do this

If let foo = foo {
// bar
}

What if the compiler would understand

If let foo {
// bar
}

As if the `= foo` would be there?

I’d find it great syntactic sugar.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution