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

Thorsten Seitz tseitz42 at icloud.com
Sat May 28 14:09:33 CDT 2016


> Am 28.05.2016 um 20:28 schrieb Haravikk via swift-evolution <swift-evolution at swift.org>:
> 
>> On 27 May 2016, at 20:11, Joe Groff via swift-evolution <swift-evolution at swift.org <mailto: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 prefer `where` iff the condition references a variable bound in the let-binding.

-Thorsten


> 
> 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/c74f5dcd/attachment.html>


More information about the swift-evolution mailing list