Hey all,

As usual, apologies if this horse was beaten ages ago before I joined the 
mailing list, but thought I would bring this up.

I was typing the above (for the hundredth time) the other day and I was 
wondering whether it might be worth considering offering a shorter syntax:

guard let x, y, z else {…}

I was never convinced why implicit nil checks (i.e. if x {…}) were such a bad 
thing.  But now in Swift it seems that it would be much more convenient to be 
able to simply skip the assignment part of the expression and define the above 
as guaranteeing and unwrapping x, y and z in the appropriate scope.

I think with such powerful and already compact expressions now wanting to get 
on the same line,adding this would make the language even more compact and 
elegant.  It could be added as a non-source-breaking change, still allowing x = 
x for those who prefer it, but could significantly tighten up such uses, which 
I’m finding are ubiquitous in my code.

Any thoughts?

-d

_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to