[swift-evolution] If let syntactic sugar
Taras Zakharko
taras.zakharko at uzh.ch
Thu Feb 4 09:26:34 CST 2016
There are two (or even three) active discussions about this very topic ;)
— Taras
> On 04 Feb 2016, at 16:22, Craig Cruden via swift-evolution <swift-evolution at swift.org> wrote:
>
>
> Ceylon does something like that - but it is more readable / understandable IMHO.
>
> It uses “if exists something” and then something inside the scope of the if is unwrapped for use. No new variable, it reads almost exactly as it is.
>
>>
>> So the code above would be:
>>
>> var something: Type?
>>
>> func foo() -> Void {
>> if let something {
>> doStuff(something)
>> }
>> }
>>
>> Let me know what you think and also if you have questions.
>>
>> Best regards,
>> Massimo Frasson
>> iOS Developer, Belka srl
>> _______________________________________________
>> swift-evolution mailing list
>> swift-evolution at swift.org
>> https://lists.swift.org/mailman/listinfo/swift-evolution
>
> _______________________________________________
> 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/20160204/3be59b19/attachment.html>
More information about the swift-evolution
mailing list