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

# Axel Rauschmayer (14 years ago)

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.

# Brendan Eich (14 years ago)

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.