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

David Rönnqvist david.ronnqvist at gmail.com
Mon May 30 14:06:32 CDT 2016


> 	• What is your evaluation of the proposal?

Mixed. But I think it leans towards the negative. 

At first I thought it was a big improvement, but after looking at how our team currently writes guard statements, the where clause is almost always using the unwrapped value (as opposed to an arbitrary boolean condition). The way we’ve been using it makes it feels like the optional unwrapping and the where clause belongs together, and I find that the where keyword is easy to skim for at the end of the line to look for other criteria on the unwrapped value.

Also, in most of our cases (although that may be because of the current syntax) there is only one where clause and no further unwrapping after that. In such cases, I find the current syntax very readable. More so than I find the semicolon syntax. 

guard let x = someOptional where x > 0 
    else { }

I acknowledge that the semicolon (or newline) versions are "simpler" and probably more suited for complex guard statements with many conditions and possibly also a mix of conditions that aren’t directly related to the optional unwrapping before them. However, I would not want to trade for that for what I feel is the more readable syntax in the more common cases.

Also, if I read the proposal correctly it would be possible to combine different boolean conditions using a “;”. Meaning this:

if x == 0 && y > x { }

would be the same as this:

if x == 0; y > x { }

which is more consistent in combining conditions but introduces two different ways of AND-ing two boolean conditions. 
It’s currently not possible to combine boolean conditions with a comma like this, and if that remains the case with semicolons, then this isn’t an issue.


> 	• Is the problem being addressed significant enough to warrant a change to Swift?

I'm not sure about that. 

> 	• Does this proposal fit well with the feel and direction of Swift?

Yes

> 	• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?

No

> 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?

Read the proposal in detail.

- David

27 maj 2016 kl. 21:11 skrev Joe Groff via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>>:

> Hello Swift community,
> 
> The review of SE-0099 “Restructuring Condition Clauses” begins now and runs through June 3, 2016. The proposal is available here:
> 
> 	https://github.com/apple/swift-evolution/blob/master/proposals/0099-conditionclauses.md <https://github.com/apple/swift-evolution/blob/master/proposals/0099-conditionclauses.md>
> 
> Reviews are an important part of the Swift evolution process. All reviews should be sent to the swift-evolution mailing list at
> 
> 	https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
> 
> or, if you would like to keep your feedback private, directly to the review manager. When replying, please try to keep the proposal link at the top of the message:
> 
> 	Proposal link:
> 
> 		https://github.com/apple/swift-evolution/blob/master/proposals/0099-conditionclauses.md <https://github.com/apple/swift-evolution/blob/master/proposals/0099-conditionclauses.md>
> 
> 	Reply text
> 
> 	Other replies
> 
> What goes into a review?
> 
> The goal of the review process is to improve the proposal under review through constructive criticism and, eventually, determine the direction of Swift. When writing your review, here are some questions you might want to answer in your review:
> 
> 	• What is your evaluation of the proposal?
> 	• Is the problem being addressed significant enough to warrant a change to Swift?
> 	• Does this proposal fit well with the feel and direction of Swift?
> 	• If you have used other languages or libraries with a similar feature, how do you feel that this proposal compares to those?
> 	• How much effort did you put into your review? A glance, a quick reading, or an in-depth study?
> 
> More information about the Swift evolution process is available at
> 
> 	https://github.com/apple/swift-evolution/blob/master/process.md <https://github.com/apple/swift-evolution/blob/master/process.md>
> 
> Thank you,
> 
> -Joe
> 
> Review Manager
> _______________________________________________
> 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/20160530/8c0c2dae/attachment.html>


More information about the swift-evolution mailing list