Re: Block lambdas: how about a.map(arg1, arg2) { |x| … } ?

Brendan Eich brendan at mozilla.com
Sat Sep 24 13:45:21 PDT 2011


On Sep 24, 2011, at 8:05 AM, Axel Rauschmayer wrote:

> I love the paren-free syntax for control structures. But what if you want the control structure to take parameters? However, that might make parsing too complicated.

That's covered by the grammar in the strawman, but you have to curry:
CallWithBlockArguments :
    CallExpression [no LineTerminator here] BlockArguments

BlockArguments :
    BlockLambda
    BlockArguments [no LineTerminator here] BlockLambda
    BlockArguments [no LineTerminator here] ( InitialValue )

Your Subject: line's a.map would return a function that captures arg1 and arg2, and takes the block-lambda {|x|...} as its sole parameter.

/be

> 
> -- 
> Dr. Axel Rauschmayer
> 
> axel at rauschma.de
> twitter.com/rauschma
> 
> home: rauschma.de
> blog: 2ality.com
> 
> 
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss



More information about the es-discuss mailing list