[swift-evolution] [Pitch] making where and , interchangeable in guard conditions.
Erica Sadun
erica at ericasadun.com
Fri May 20 13:01:21 CDT 2016
> On May 20, 2016, at 11:53 AM, Matthew Johnson <matthew at anandabits.com> wrote:
> I am less certain about allowing simple boolean expressions that are not introduced by the `where` keyword (excepting the first one which is introduced with the `guard` keyword). I think this is a separate question that should receive independent consideration. I think a reasonable argument can be made both ways.
That's kind of the heart of the matter.
There's an assumption that guard statements are:
`guard` (conjoined boolean tests) | (conjoined boolean tests,)? (pattern | binding (where boolean)?, )+ else {...}
Right? (Except I couldn't figure out how to grammar out the final comma,) I'm suggesting:
`guard` ((boolean | (pattern | binding (where boolean)?)),)+ else {...}
instead. (And ditto about final comma) This promotes boolean statements to the same standing, so they're not limited to the start of the guard statement or syntactically tied to a pattern/binding where there may be no semantic basis.
-- E
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160520/4ee5ef0c/attachment.html>
More information about the swift-evolution
mailing list