On Tue, Mar 6, 2012 at 6:50 PM, Isaac Schlueter <i...@izs.me> wrote: > A great many letters have been typed regarding the number of letters in the > word "function". > > What if we just made the keyword "function" entirely optional, dart-style? > > ShortNamedFunctionDeclaration :Identifier <no_linebreak> ( FormalParameterListopt ) > <no_linebreak> { FunctionBody } > ShortNamedFunctionExpression :Identifier <no_linebreak> ( FormalParameterListopt ) > <no_linebreak> { FunctionBody } Note that the identifier is no longer > optional, and that no linebreak is allowed between the parameter list and > the body, unlike current function decl/exprs. > myList.forEach(x (item) { > item += 2 > doSomethingElse(item) > assert(typeof x === "function") > })
An interesting property of this syntax is that anonymous functions can be written this way: myList.forEach(λ (item) { doWith(item) }) (it can also be `lambda (item) { ... }`) _______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss