Is that just a sketch or will inout
be written before employee
, as in:
func f(inout employee: Employee) { /* … */ } // ERROR: 'inout' before a parameter name is not allowed, place it before the parameter type instead
?
The feature's resemblance with (what's intended in) the above and the resulting error message would probably lead most people to expect:
for employee: inout in company.employees { … }
Then comes the question: What is the lhs
in a for lhs in rhs { … }
statement?
Is it like a pattern matching expression where you can write eg case let .some(e)
or is it like a parameter declaration or is it a unique mix of a bit of both? The grammar currently says "caseopt pattern":
GRAMMAR OF A FOR-IN STATEMENT
for-in-statement →
for
case
opt patternin
expression where-clauseopt code-block
And why is the where clause together with the rhs
(to which it doesn't apply) rather than with the lhs
which it does apply to? And isn't it more like a guard
than a where
? (cc @Erica_Sadun, @beccadax)
Help us Erick Meijer and Conal Elliott!