Function Syntax

Isaac Schlueter i at izs.me
Tue May 10 17:31:04 PDT 2011


As always, very well put, Douglas.

On Tue, May 10, 2011 at 16:53, Douglas Crockford <douglas at crockford.com> wrote:
> ECMAScript has a large set of problems. I think that the fact that 'function'
> has eight letters is at the bottom of the priority list. And yet, I am open to
> the possibility of introducing new syntactic sugar to the language to make
> the expression of functions more elegant.
>
> I look at ECMAScript as serving four groups:
>
> 1. The beginners for whom the language was designed.
> 2. The web developers who owe their livelihoods to the language.
> 3. The scientists who will use the language for greatness.
> 4. Language designers and critics.

I think that there is a very subtle way in which Ruby's blocks are
perceived, largely because they involve less ceremony than
JavaScript's functions.  Making the expression of functions more
elegant will go a long way towards making newcomers grok their
importance and power, as well as a lot of typing (and visual clutter)
for those of us in the second group.

> Some of the proposals and wishes for new syntax are alarming, in that they
> appear to be increasing the problem set, rather than reducing it. For
> example,
> the language has a confusion between blocks and object literals. Any new
> syntax
> should reduce or eliminate this confusion, not amplify it.

+1.

> I want to make the language easier to beginners to learn, streamlining the
> syntax, replacing automatic semicolon insertion with statements that are
> by design semicolon free.

Some of us are already writing JavaScript this way :)

The newline elision thing is unnecessarily persnickety, though.


More information about the es-discuss mailing list