On Dec 2, 2008, at 6:26 PM, Eric Suen wrote:
I really don't think prefix is neccessary, what about:
(a;b;c) {...}
or
(a:b:c) {...}
2nd one may have problem with '::' or TypedIdentifier in ES4.
This loses almost all connection with the rest of the language.
Arguments are passed in a comma separated list. Wrapped in
parentheses. The Smalltalk hommage loses the parens but keeps the
commas. Any other separator is just wrong, sorry.
C# uses (a, b, c) => ... but in JS the comma operator makes that nasty
to parse top-down. I think the only candidates have to be of the form
^(a, b, c) {...}
(^ could be another character, but it seems to beat \ as others have
noted), or else the Smalltalky
{ |a, b, c| ... }
At this point we need a bake-off, or a convincing argument against the
unusual vertical bar usage.
/be
Regards,
Eric Suen
----- Original Message -----
From: "Maciej Stachowiak"
<[EMAIL PROTECTED]>
Newsgroups: gmane.comp.lang.javascript.ecmascript4.general
To: "Brendan Eich" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, December 02, 2008 4:59 AM
Subject: Re: Allen's lambda syntax proposal
On Nov 29, 2008, at 10:30 PM, Brendan Eich wrote:
At the TC39 meeting two weeks ago in Kona, we had a brief
bikeshedding
discussion about lambda syntax and why it matters. Observation:
blocks in
Smalltalk being lightweight means users don't mind writing them
for control
abstractions, compared to JS functions in ES3. In Smalltalk,
ignoring JS,
it's hard to beat [ and ] as overhead, although one must count
the message
selector and its punctuation too.
Allen Wirfs-Brock put his proposal, which will not shock you who
know
Smalltalk or Allen, on the whiteboard:
// Instead of lambda (a, b, c) { ... }, why not:
{ |a, b, c| ... } ?
I like the brevity, but having the formals inside the block and in ||
delimiters seems like it will look weird in an ECMAScript program.
For
function declarations the parameters go in parentheses, and for calls
(presumably also for lambda calls), the arguments go in parens. If
brevity is
important, why not lift the lambda syntax from modern pure
functional
languages:
\(a, b, c) { ... }
That's backslash as a lambda operator. This has one more character
than your
version, but will make formals and parameters look the same for
functions,
lambdas, and calls, and will avoid putting the formals inside the
body which
I think is confusing and visually hard to scan.
Regards,
Maciej
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________
Es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss