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

Brandon Knope bknope at me.com
Sat May 28 15:14:39 CDT 2016


I'm not sure how feasible this is...but why not remove the conditional case to remove the ambiguity?

Conditional case seems somewhat esoteric compared to the current behavior that many people are used to. (I.e. How many know of and use a conditional case?)

Is it worth de-beautifying the syntax to accommodate conditional case? If it is (and some have argued it's not de-beautifying anything but that's just IMO) then I stand corrected.

To me, this is a very far reaching change. And I hope it is being seen and considered by more than just the few of us because I would hate for a few to decide on something that will affect many. 

And this *would* affect many people (unless I am being too dramatic here) and significantly change the "look" of their code. 

My slightly dramatic .02,
Brandon 

> On May 28, 2016, at 1:32 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On May 28, 2016, at 1:10 AM, David Hart via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>> Yet another alternative: would it be possible to disallow commas as variable declaration separators and use them for condition clause separators again:
>> 
>> let a = 4, b = 8 // becomes illegal and requires to separate them on two lines
>> 
>> if a > 4, let c = foo(), let d = bar(), c != d { // now comma is not ambiguous anymore
>> }
> 
> The ambiguity is between “case” and “let” conditions, specifically because “case” takes a pattern, and “let” is a valid pattern:
> 
> guard (pattern1) = expr1, let x = expr2 else
> 
> can be:
> 
> guard (pattern1) = expr1, let (x) = expr2 else
> 
> or:
> 
> guard (pattern1) = expr1, (let x) = expr2 else
> 
> -Chris
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution


More information about the swift-evolution mailing list