optional "function" keyword

Isaac Schlueter i at izs.me
Tue Mar 6 12:20:16 PST 2012

On Tue, Mar 6, 2012 at 12:06, Brendan Eich <brendan at mozilla.org> wrote:
>> Yes, an identifier is required.  It would not be possible to define an
>> unnamed function in this way.
> Why not express an anonymous function, though? Definition != expression. As
> usual, an expression *statement* could not start with ( and consist entirely
> of a function-keyword-free anonymous function expression.

I see.  So, you'd be suggesting using:

    ( args ) { functionBody }

as an anonymous function expression, though not a function expression
statement? What about these?

    ;(( args ) { functionBody })
    !( args ) { functionBody }

Certainly, this is quite nice:

    myList.forEach((item) { .. })

> Dart has mandatory semicolons to help avoid trouble around the edges of
> statements/definitions.
> Candor is new, so no one has deep experience.
> To get further we'd need some brave souls to try this out with a trivial
> transpiler, at scale.

True that.

More information about the es-discuss mailing list