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

Haravikk swift-evolution at haravikk.me
Sat May 28 13:28:11 CDT 2016


> 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160528/462b0480/attachment.html>


More information about the swift-evolution mailing list