[swift-evolution] [Review] SE-0099: Restructuring Condition Clauses
Matthew Johnson
matthew at anandabits.com
Fri May 27 20:12:22 CDT 2016
> On May 27, 2016, at 7:50 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
>
> I don't believe that was the case with the semicolons in the original for;; loop, was it?
No, I don’t believe so, but that’s gone now. And it is pretty uncommon to see `for` loop clauses on multiple lines. Not so with `guard`.
> On Fri, May 27, 2016 at 20:37 Matthew Johnson via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>
>
> Sent from my iPad
>
> On May 27, 2016, at 7:22 PM, Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
>
>>
>>> On May 27, 2016, at 6:19 PM, Matthew Johnson <matthew at anandabits.com <mailto:matthew at anandabits.com>> wrote:
>>>>> Also, can someone refer me to an example of this statement: "This proposal resolves this problem by retaining commas as separators within clauses (as used elsewhere in Swift) and introducing semicolons to separate distinct kinds of clauses (which aligns with the rest of the Swift language)”
>>>>
>>>> guard let x = opt1, y = opt2, z = opt3; booleanAssertion else { }
>>>>
>>>>>
>>>>> I rarely see any semicolons after the removal of C loops. So if someone could put me to where this is used elsewhere in Swift, please do!
>>>>
>>>> Using semicolons brings conditions in-line with how semicolons are used as separators elsewhere in the Swift grammar.
>>>
>>> Not really. We can use a newline instead of the semicolon elsewhere.
>>
>> Outside of braces? Think of the guard/if/while creating a new miniscope that has no braces, and whose value assignments escape to the surrounding scope. I defer to Chris for better technical answers.
>
> They are only used for statement separators as far as I know. Statements only happen inside code blocks, which are always surrounded by braces. So no, not outside braces as far as I know.
>
> But I don't know what that has to do with the fact that newline can be used as an alternative. It's just an alternate separator. As far as I know, everywhere semicolons are used as separators newlines are accepted as an alternate separator.
>
>>
>> -- E
>>
> _______________________________________________
> 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/20160527/168180d1/attachment.html>
More information about the swift-evolution
mailing list