[swift-evolution] [DRAFT] Regularizing Where Grammar (was Re: Add a while clause to for loops)

David Hart david at hartbit.com
Sat Jun 11 05:14:45 CDT 2016


-1 I have similar concerns on the mental ambiguity of the direction this is going.

> On 10 Jun 2016, at 22:15, Thorsten Seitz via swift-evolution <swift-evolution at swift.org> wrote:
> 
> -1
> 
>> Am 10.06.2016 um 21:10 schrieb Brent Royal-Gordon via swift-evolution <swift-evolution at swift.org>:
>> 
>> if case .some(let Point.cartesian(x, y)) where x < y = json["rect"]?["origin"].flatMap(.init(rawValue:)) { … }
> 
> This: `where x < y = json[…]` is *very* unreadable and probably unparseable as it is missing a delimiter between the boolean expression and the expression behind the assignment operator. And I do not count the assignment operator as a sufficient delimiter.
> 
> 
> I’ll give the following counterargument against this shuffling around of `where` or trying to eliminate it:
> 
> 	if case .some(let x) = someExpression where x > 0
> 
> 	for x in xs where x > 0
> 
> These are actually very consistent in their grammar when you look at it like follows:
> 
> 	<target> <assignment op> <source> where <condition>
> 
> 
> 	if case .some(let x) = someExpression where x > 0
> 
> 	target: `case .some(let x)`
> 	assignment op: `=`
> 	source: `someExpression`
> 	condition: `x > 0`
> 
> 
> 	for x in xs where x > 0
> 
> 	target: `x`
> 	assignment op: `in`
> 	source: `xs`
> 	condition: `x > 0`
> 
> 
> That is I’m arguing the `where` grammar is already quite regular and should not be changed. And yes, I’d like to have `where` back in `case`. And `let`.
> 
> -Thorsten
> 
> _______________________________________________
> 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/20160611/768c6c20/attachment.html>


More information about the swift-evolution mailing list