Allen's lambda syntax proposal

Allen Wirfs-Brock Allen.Wirfs-Brock at microsoft.com
Mon Dec 1 17:37:06 PST 2008


>-----Original Message-----
>From: es-discuss-bounces at mozilla.org [mailto:es-discuss-
>bounces at mozilla.org] On Behalf Of Douglas Crockford
...
>because you can think of the \ as being an abbreviation of function.
>
>     \ name(a,b,c) {}
>
>Just don't start your function name with u.
>

Exactly, that's why I didn't mention this possibility.  I don't think it would be acceptable to have that \u ambiguity.

Smalltalk does not have a way (other than variable assignment) to name closures for recursive reference and it rarely has proven to be a problem.  If you really want to pass a recursive lambda to a function g you could define it using a const:
        const  fact = {|n|  (n<=1) ? 1 : fact(n-1)* n};
      g(fact)
or more perversely:
        g({||const  fact = {|n|  (n<=1) ? 1 : fact(n-1)* n}; fact}() );

(the second statement of the outer lambda wouldn't be needed if const evaluates to the value of its initialization expression)



More information about the Es-discuss mailing list