Concise functions, Nonexistent lambdas, Explicit tail calls

Jon Zeppieri jaz at bu.edu
Tue Dec 9 12:21:40 PST 2008


On Tue, Dec 9, 2008 at 2:19 AM, Michael Day <mikeday at yeslogic.com> wrote:
> Hi,
>
> This proposal consists of three ideas for concise functions, nonexistent
> lambdas, and explicit tail calls that go well together. It supersedes any
> previous proposals I may have made on these subjects :)
>
> CONCISE FUNCTIONS
>
> (1) Treat "fun" as a keyword that is exactly equivalent to the existing
> "function" keyword used in function expressions and declarations.

This will break existing code:
http://www.google.com/codesearch?q=lang%3Ajavascript+%22var+fun%22&hl=en&btnG=Search+Code


> ADVANTAGES OF CONCISE FUNCTIONS
>
> Both changes are very easy to implement and should be compatible with
> top-down parsers. The two changes combine to allow very concise function
> declarations, while still preserving the syntactic feel of JavaScript.
>
> As a bonus, any future additions to expressions, such as comprehension
> expressions or other control structures, will be immediately usable in
> expression function bodies.

The benefit seems vanishingly small.  I don't think it's enough to
cover the (admittedly minor) cost in language complexity.

One of the claimed advantages of the lambda proposal is that it would
reduce complexity (of one kind) by allowing most of the language to be
understood in terms of a small kernel language.  Then again,
complexity comes in many flavors, and some users will be confused by
unfamiliar additions.  Lambda could be introduced only as a
specification fiction (like the reviled "activation object").  But
it's useful.

>
> NONEXISTENT LAMBDAS
> [...]
>
> Refraining from adding a new lambda construct will make JavaScript easier to
> specify...

If you're right about this, I'd consider it a powerful argument
against the lambda proposal.  It's not obvious, however.

-Jon


More information about the Es-discuss mailing list