On Dec 1, 2008, at 5:37 PM, Allen Wirfs-Brock wrote:

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:es-discuss-
[EMAIL PROTECTED] 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.

I think requiring a space after the \ if a name is provided would remove the potential 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)

g(\ fact(n) { (n<=1) ? 1 : fact(n-1) * n });

That seems sweeter.

 - Maciej

_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to