Semantics and abstract syntax of lambdas

Breton Slivka zen at
Thu Dec 18 17:47:37 PST 2008

Okay, is it possible to introduce lambdas with no new syntax at all?
possibility 1:
for instance, suppose that we have a function that doesn't use
arguments or "this". Can the implementation statically analyze a
function to determine whether a function uses those, and if it does
not, optimise it? Can we do stack optimized tail calls using the
"return" keyword, via static analysis? Are there other ways for an
implementation to examine how a function is used to optimize
performance, without altering syntax or semantics?

possibility 2:
This is probably a silly question, but, can we reuse object literal syntax?

mylambda = { let: {a:null, b:null, c:0}, call: { a+b+c } };,2); //4,3,3); //9

in this case, assigning a block to a property in an object literal is
invalid. I must admit ignorance of how the parser/interpreter works
here. Is it possible to take this context as a special case, and treat
the block as a lambda body, and a let property as a parameters list
with default values? I'm thinking about treating code as data here.
Kind of like lisp's S-expression syntax: originally designed for data,
but adapted to express programs.

are there other possibilities for expressing the lambda functionality
using only the syntax that ecmascript already has?

More information about the Es-discuss mailing list