On Mon, Oct 12, 2015 at 10:12 AM, Mohsen Azimi <[email protected]> wrote: >> Your syntax is ambiguous: Should your code be interpreted as: >> >> let passed = objs.filter($0 => $0.passed) >> >> or: >> >> let passed = $0 => objs.filter($0.passed) > > I don't understand why you parsed it in the second way Claude?
It's not about the "why". He's trying to tell you this code _is_ ambiguous. The parser cares not about the why. Look at the generic case; how could the parser know how `#0` is scoped? There is an ambiguity and you'll need some way of telling JS what the scope is of that `#0`. This is why there's an arrow. This is why you need to wrap arguments in parenthesis: Disambiguation. Basically; try to think of ways how your example should be translated. Then try to see if they _can_ be translated differently. If they can, then you need to think of a way to disambiguate. In the above, having no "function offset marker" (like what the arrow is) means you cannot know where it starts. On a personal two cents; ugh, changes in this proposal would only lead to even worse illegible code. - peter _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

