[swift-evolution] guard let x = x

Kenny Leung kenny_leung at pobox.com
Mon Oct 31 14:28:10 CDT 2016


I’m not sure what it means to list foo twice. I guess this would be illegal.

-Kenny


> On Oct 31, 2016, at 12:22 PM, William Sumner <prestonsumner at me.com> wrote:
> 
> 
>> On Oct 31, 2016, at 1:11 PM, Kenny Leung via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> OK then, how about an extension to the proposal that says “guard variable always implies guard unwrap variable when the only thing present in the guard clause is an optional or list of optionals”?
>> 
>> So you could write
>> 
>> guard foo else {
>> }
>> 
>> guard foo, bar else {
>> }
>> 
>> -Kenny
> 
> 
> That would enable some strange-looking code:
> 
> var foo: Bool?
> guard foo, foo else {}
> 
> Preston



More information about the swift-evolution mailing list