[swift-evolution] [Review] SE-0099: Restructuring Condition Clauses

Xiaodi Wu xiaodi.wu at gmail.com
Sat May 28 14:21:04 CDT 2016

There's already an inconsistency in where clause behavior for `if` and
`while` versus `for` loops. It's nice IMO that the former uses are
eliminated in this proposal.

Again, whether declaring multiple variables after a single let is a good
idea or not is, I think, out of scope for this proposal. If it's changed
here, it should be changed everywhere, and that's another discussion

On Sat, May 28, 2016 at 14:28 Haravikk via swift-evolution <
swift-evolution at swift.org> wrote:

> On 27 May 2016, at 20:11, Joe Groff via swift-evolution <
> swift-evolution at swift.org> wrote:
> • What is your evaluation of the proposal?
> Uncertain. I understand the intent behind it, but personally I really like
> the where clause as it covers most cases where I need to mix and match, and
> I feel that it’s very clean, clear, reads well and encourages best
> practice. I definitely prefer the first of these two options:
> if let foo = maybeFoo where foo > 5 { … }
> if let foo = maybeFoo; foo > 5 { … }
> I also get the intent behind semi-colon usage for avoiding ambiguity, but
> I’d prefer it to be optional for cases where I really need to use it. We
> could perhaps make the compiler more strict to encourage its use though,
> i.e- anywhere the comma becomes ambiguous visually a warning could appear
> suggesting a semi-colon?
> • Is the problem being addressed significant enough to warrant a change to
> Swift?
> Simplification of some of the features of conditionals would certainly be
> nice, and easier to maintain. I wouldn’t say it’s critical though as
> personally I don’t encounter many issues with the current syntax.
> • Does this proposal fit well with the feel and direction of Swift?
> Hard to say, I like the consistency of having the where clause in regular
> conditionals rather than just loops, so I’m not in favour of that change.
> Semi-colon use kind of fits with how they’re used for multiple statements
> on a line, but I prefer how commas look within conditionals.
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160528/ed2d0165/attachment.html>

More information about the swift-evolution mailing list