Semantics and abstract syntax of lambdas

Yuh-Ruey Chen maian330 at
Mon Dec 8 01:08:35 PST 2008

Jon Zeppieri wrote:
> The only problem with the proto-proposal to limit lambda bodies to
> expressions (which is otherwise a good idea) is that the ES expression
> sub-language isn't powerful enough.  The ternary expression is awful
> for conditionals more complex than "if a then b else c."  Without a
> let expression, people would be nesting immediately applied lambdas,
> which quickly becomes unwieldy.  Without a letrec expression, they
> would be forced into vomit-inducing syntactic horrors to bind local
> recursive functions.
> So, unless people want to expand the expression grammar significantly,
> I think the expression body is a nonstarter.

How feasible would it be to make JS a pure expression language? That is,
can the language be modified to allow things like:

x = if (a)

first_test_prop = for (let p in o)
    if (/^test/.test(p)/) {
        p; break;

More information about the Es-discuss mailing list