[swift-evolution] [proposal] Allow trailing closures in 'guard' conditions
Andrey Tarantsov
andrey at tarantsov.com
Wed Mar 23 15:27:49 CDT 2016
+1, but
> Expand the scope of “if” and “while” statements
+2 for this. At least a dozen times I've been beaten by changing
let foo = bar.map { ...}
into
if let foo = bar.map { ...} {
...
}
only to find myself with a compiler error (because my brain just doesn't register this transformation as invalid).
I would be fine with limiting such a call to a single line, because a multiline scenario looks crazy anyway. I would also be fine with disallowing single-line IFs in this case, because, again, they look crazy. Those two limitations would allow unambiguous parsing in all cases.
And yay for unbounded lookahead and heroics. We should use all that RAM and CPUs for something, after all.
A.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160324/ba594f63/attachment.html>
More information about the swift-evolution
mailing list