On 2008-12-01, at 11:30EST, Mark S. Miller wrote:

On Mon, Dec 1, 2008 at 7:31 AM, P T Withington <[EMAIL PROTECTED]> wrote:

On 2008-11-30, at 01:30EST, Brendan Eich wrote:

// Instead of lambda (a, b, c) { ... }, why not:
{ |a, b, c| ... } ?


I would rather have a more literate syntax, lest we degenerate to where
practically any comic book blasphemy is a valid program.

(BTW, I'm pretty sure I have that same Byte issue, in a similar box, with a similar musty smell, _and_ "the blue book". Back then, worrying that 'line noise' or the death throes of your modem hanging up would write code for you was a legitimate concern. Today, it is just my old eyes that might gloss over `{||` and wonder why the `var`s in that block are not visible in the
enclosing function...)


Since it's a lambda, the 'var's will be visible in the enclosing function.

Eh?  So:

function () {
  var foo = 42;
  {|| var foo = 3; }
  return foo;
}

and:

function () {
  var foo = 42;
  { var foo = 3; }
  return foo;
}

Give the same answer?

The point of having a very compact syntax for lambda is too make it pleasant to write control abstractions, as one does casually in Smalltalk. With the verbose "lambda" spelling, people will avoid those, or invent macro systems (as Scheme programmers do) mostly so they can avoid seeing all those extra
"lambda" letters in the code.

Think of lambdas as blocks plus a bit more, rather than function minus a
bit. Viewed this way, their block-like syntax is a virtue.

I agree with the goal of compactness. I just don't like it to be too compact. Call me a curmudgeon. I don't like that `not` is spelt `!` or that it is so easy to make a one-letter misspelling of `eql` and end up with `setq` either.
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to