>
> If Expression covers FormalParameterList then LR(1) is enough -- we'll
> know when we see that arrow (or { on same line as the ) before it). This is
> considered somewhat future-hostile by some on TC39.
>

I need to think about cover grammars some more...


>  (x,y) => {p:x*y} // return an object literal
>

Ha - brilliant!  IMO this ambiguity shouldn't be blanketed over with
additional lookahead and label statement restrictions.

The most bang for the buck, as I see it, is in this form:

(x, y) => { FunctionBody }

If we have implicit return (which I think we can bundle in with the "=> is
different" meme), then we have a sufficiently succinct alternative:

(x, y) => { { p:x * y} }

(I have yet to think through the issues with implicit return.)

I think (x, y) => expr can be difficult for human readers (particularly
non-experienced readers) to figure out anyway.

It might be useful to analyze a cross-section of real world code to get a
feel of how often (x, y) => expr would be applicable.  The sweet spot that
I'm aiming for is to make the callback syntax/semantics better, e.g:

IO.readText(path).then((text, err) => {
    // Many statements in here, including:
    this.whatever();
});

My hunch is that (x, y) => { FunctionBody } would cover >=90% of the use
cases out there, but it's just a hunch.

kevin
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to