[swift-evolution] [Review] SE-0099: Restructuring Condition Clauses
Brandon Knope
bknope at me.com
Fri May 27 16:06:37 CDT 2016
I am giving a -1 for this proposal.
While I am sure it has merit, I am finding it to be a really technical change (meaning it makes the language look more technical at the expense of some of its beauty)
First, I do not find this example very compelling:
guard
x == 0,
let y = optional where z == 2
else { ... }
…in fact I did not know you could even do something like this: putting an unrelated variable in the where clause. Why not just require that variables in the where clause must have been bound from a previous statement in the conditional. This would make the where clause related to the clause that proceeds it
For example:
guard
x == 0,
let y = optional where y == 2 //y was just bound from an optional
else { ... }
This I believe is more in spirit with what was intended with where clauses. To me, it should be an error to begin a where clause with a variable that does not proceed it anywhere in the conditional.
Second, I have really gotten use to not needing to use semicolons, and this proposal seems to use/require them in very common situations.
After shedding the requirement of semicolons from ObjC…now we will have to use them a lot again?
Third, the format will look like this in most people’s code:
guard x == 0; let y = optional; y == 2 else { //can the third bool condition even refer to y? Is it still in scope?
...
}
(in the above example, y == 2 is related to the optional that precedes it. Now it looks like a distinct statement)
compared to
guard x == 0, let y = someOptional where y == 2 else {
...
}
To my eyes: the old way reads more naturally and looks less heavy. I think it keeps its expressiveness and also keeps it somewhat poetic.
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)”
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!
Thanks,
Brandon
> On May 27, 2016, at 3:11 PM, Joe Groff via swift-evolution <swift-evolution at swift.org> wrote:
>
> 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
>
> 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
>
> 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
>
> Thank you,
>
> -Joe
>
> Review Manager
> _______________________________________________
> 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/20160527/3a0ff647/attachment.html>
More information about the swift-evolution
mailing list