Function Syntax

Douglas Crockford douglas at crockford.com
Tue May 10 16:53:11 PDT 2011


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 want to improve the language for the first three groups. I don't 
believe it
will be possible to please the fourth group, so we shouldn't even try.

The language has difficult syntax due to its C/Fortran heritage which daily
makes the use of the language unnecessarily painful. I would like to repair
the traps and confusions so that the language can be practiced more
productively. Brendan says that that ship has sailed, or sunk, but I think
introduction of expressive function syntax gives us some license to 
reconsider
some things.

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.

I see this design problem as an intricate puzzle. There are many conflicting
goals, and the solution is far from obvious. If we can solve it, and I am
unreasonably optimistic that a solution is possible, then we will have 
obtained
a language that is easier to read, easier to write, and more resistant to
error. If we get it wrong, then we will have accomplished something far 
worse
than having done nothing.

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.

I want to smooth over the language's rough areas so that web 
applications can
be developed more effectively, with fewer nasty surprises.

And I want the language to help us better harness the power of the function.
I think that is the best path for keeping this language viable for many 
years.

At this point I do not know what the language should look like. But I 
think I
will know it when I see it.



More information about the es-discuss mailing list