HTML5DevConf: Doug Crockford "Which Way Is Forward" for Javascript

TC39 is bombarded with feature requests to make Javascript look more like Java/Python/Ruby/...

To avoid going in circles, you need to know history.

Progress doesn’t wait for the next new idea - it waits for consensus on an old idea.

Romantic idea about progress: invention, adoption, use – it’s never so simple.

Dijkstra - Humble programmer.

Dijkstra’s famous letter - GOTO Statement Considered Harmful: More gotos -> less quality.

The famous GOTO argument - two sides:

* Radicals - it’s disaster.

* Reactionaries - performance, tradition, freedom, pride, majority.

* Moderates - avoid, but do not remove

We are figuring out best way to write programs, other arguments are ridiculous.

Example or paradigm shift with GOTO:

1959 - somebody told Dijkstra that GOTO is bad

1968 - Article GOTO Considered Harmful

1973 - C (has GOTO)

1985 - C++ (has GOTO)

1995 - Java (has GOTO, but goto is reserved word, just to be sure :))

Programming languages should help writing programs bug-free.

Overflow of int: max + 1 = -min … worst possible error.

Java: byte/short/int/long/float/double - easy to pick a wrong one

Javascript: number (same as double) - no choice, cannot pick a wrong number.

But Javascript one number type is the wrong type - floating point.

Binary Floating point - made a lot of sense in history, but now it only complicate things. Cannot accurately represent decimal fractions.

Stupid + operator


Proof of Correctness - test can only prove the existence of bugs, not their absence. Proof > Test.

> Beware of bugs in the above code. I have only proved it correct, not tried it. Donald Knuth (1977)

1958 LISP

1973 ML

1975 Scheme (MIT)

1984 Common Lisp

1990 Haskell

1999 Javascript