Block lambda grammar: BlockArguments

Axel Rauschmayer axel at
Fri Jan 13 21:09:17 PST 2012

> Fixed:
> The LeftHandSideExpression productions and their kids (NewExpression and CallExpression) are funky and I keep misremembering how NewExpression is what bottoms out via MemberExpression -> PrimaryExpression at Identifier.

If I read the grammar correctly, then you can do things such as (read "~~~>" as "desugars to"):

     myfunc {|| } {|| } (arg3) (arg4)  ~~~>  myfunc({|| }, {|| }, arg3, arg4)

The above is a function call with 4 arguments. My wish would be different: I would want to put lambdas after a function or method call and treat those lambdas as additional arguments:

     myfunc(arg1, arg2) {|| } {|| }  ~~~>  myfunc(arg1, arg2, {|| }, {|| })
     myfunc {|| } {|| }  ~~~>  myfunc({|| }, {|| })

Rationale: I would always make lambdas trailing arguments, similar to
     if (cond) {} {}
And I would rather achieve this effect without currying. Following a block with a non-block doesn’t seem like a good idea.

Has the other approach been considered?

Dr. Axel Rauschmayer
axel at


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list