Allen's lambda syntax proposal

Peter Michaux petermichaux at gmail.com
Wed Dec 3 13:23:31 PST 2008


Summary of what I've read:

The syntax \(){} has a named lambda problem if the lambda name starts
with a 'u'. Depending on whitespace between the backslash and the
identifier seems like it will cause bugs

  \u03c0(){}
  \ u03c0(){}

The syntax ^(){} has a semicolon insertion ambiguity. What does the
following mean?

  x = x
  ^(){}

The {||} syntax has an optional parameters problem. What does the
following mean?

  {|a, b = 1 | c | d}

The other suggestion which seems to be on the table has been a new
keyword "lambda" or something shorter.

  lambda() {}
  lmbd() {}
  ld() {}

Any parsing problems are already ones programmers know how to work
around. The only whinge has been that "lambda" is too long. Changing
from the 6 character "lambda" keyword to something shorter would work
technically. I think just a one character keyword would be too short
as they are commonly used for loop variables. I think the sometimes
used "fn" can't be used because "function" is already taken. Both
"lmbd" or "ld" are abbreviations which are not in the character of ES
language keywords. "var" is the only keyword abbreviation in ES3. All
other keywords are complete words and the word for the concept desired
here is "lambda".

Peter


More information about the Es-discuss mailing list