return when desugaring to closures

Igor Bukanov igor at
Sun Aug 24 01:55:05 PDT 2008

2008/8/24 Brendan Eich <brendan at>:
> I call it unnecessary to make let (x = a, y = b) {...} be shorthand
> for (function (x, y) {...})(a,b). Count characters: 24 vs. 28. Come
> on!

And in the case of the let expressions using the shorthand (it is
proposed for ES4 and available in FireFox 3.0) that allows to replace

   function optionalName(...) { return expr; }


  function optionalName(...) expr

the situation is

  let (x = a, y = b) expr


  (function(x, y) expr)(a, b)

That is again just 4 extra characters, 23 versus 27 and there is
nothing to sweeten with sugar.

Now, if those proposal of having "fun" or even "ƛ"  as a shorthand for
the "function" keyword would be resurrected, then the explicit lambda
forms would be shorter then the let forms. Plus, compared with the let
blocks or expressions, such shorthands could be used with each and
every function definition.

Regards, Igor

More information about the Es-discuss mailing list