Allen's lambda syntax proposal

Peter Michaux petermichaux at gmail.com
Tue Dec 2 11:24:02 PST 2008


On Tue, Dec 2, 2008 at 11:09 AM, David-Sarah Hopwood
<david.hopwood at industrial-designers.co.uk> wrote:
> Peter Michaux wrote:
>> 2008/12/2 Jeff Watkins <watkins at apple.com>:
>>
>>> Since the goal seems to be allowing control structures like Smalltalk
>>> (yay!), how about specifying that one lambda that follows a function
>>> invocation is passed as the final argument to the invocation.
>>
>> Brendan seemed to reject the idea that "this" could be passed as the
>> first argument to a constructor, so that "this" could be explicitly
>> named, on the grounds that the parameter lists would not match. I
>> agree that parameter lists should match. I was just asking.
>>
>> https://mail.mozilla.org/pipermail/es-discuss/2008-November/008203.html
>>
>> ----
>>
>> If a trailing block outside the parameter list is passed as the last
>> argument, then what happens when there is a rest parameter as the last
>> argument in the parameter list? It gets a bit messy to determine if
>> the last argument passed in was the last argument of some rest
>> parameters or an optional trailing lambda.
>
> Will ES-Harmony have labelled arguments? If it does then both of these
> problems go away, since the block argument can have a standard label,
> and similarly for the this argument.

(David, These comments aren't particularly in response to yours but to
the trailing lambda idea in general.)

This would lead to a "reserved label" which is adding yet another
complication to enabled a trailing lambda after the parameter list.

The language already has a nice consistent way to pass parameters to a
function: the parameters go inside the parameter list. Why add new
syntax, a trailing lambda, basically for the sake of whim, with know
consequences which require other changes to the language and likely
unknown consequences, when the language can already do what is
necessary? Using the currently available mechanism is something people
already understand and works. The only difference is an LPAREN is in a
different place. Is that worth all the problems and inconsistencies? I
don't think so. I don't even think it is even aesthetically appealing
which is supposedly the only real gain anyway.

Peter


More information about the Es-discuss mailing list