[swift-evolution] Obsoleting `if let`

Paul Ossenbruggen possen at gmail.com
Wed Feb 3 23:12:40 CST 2016


The original proposal says 

	if let name? = optionalCondition { }

This would unwrap it? 

This seems like it should be mean the opposite. For example, lets remove the “if” from this and just do a let statement:

	let name? = “some value”

this looks to me like it would take the string and upgrade it to an optional. In fact, I was thinking this would could be a new proposal. A easier way of writing this:

	let name : String? = “some value”

What is nice is this is easier to read and I think it is a kind of natural way of creating an optional without having to repeat the type.. It would also work on non literals. Is there a reason this would not work?

- Paul







More information about the swift-evolution mailing list