BT

Facilitating the Spread of Knowledge and Innovation in Professional Software Development

Write for InfoQ

Topics

Choose your language

InfoQ Homepage News Eich and Crockford on the Future of JavaScript: Insight from the Creators of JavaScript and JSON

Eich and Crockford on the Future of JavaScript: Insight from the Creators of JavaScript and JSON

This item in japanese

Bookmarks

At the recent FullStack conference in London, Brendan Eich, JavaScript creator, and Douglas Crockford, JSON creator and author of "JavaScript: The Good Parts", spoke on the future of JavaScript. Eich's focus during the conference talk was primarily around features to iterate and improve the language. Crockford's focus on JavaScript lead us to the next paradigm in software engineering, which he describes as globally distributed secure asynchronous programming.

Crockford notes that this is unnecessarily difficult currently as all programming languages, including JavaScript, are stuck in the old architecture of a single machine in a single address space. However, because JavaScript does such interesting things with functions and objects, Crockford believes that JavaScript helps with this transition more than other languages.

Eich's biggest regret with JavaScript was giving users what they asked for shortly after the initial release of the language, rather than thinking through better solutions to their problems. For example, type coercion with the == equality operator, e.g., making 12 == '12', to ease handling of the pushing of data over HTTP to the server.

Crockford notes that languages face a problem in that they potentially become too focused on "bad plastic surgery" additions instead of having a clear view of what is coming next.

Compared to a decade ago, I think less of the language is good, but I think the good part is better.

Eich spoke about the progression of how things change over the years, and how old becomes new again. For example, E4X never got accepted into the language, but React users love JSX, which is "E4X without the bad XML parts".

A significant portion of Eich's talk emphasized the value of asm and WebAssembly. Starting with a statically typed subset of JavaScript, asm.js source code can run near native speed. This performance improvement occurs because asm supports switching from just in time (JIT) to ahead of time (AOT) compilation, going straight from an abstract syntax tree (AST) to machine code generation.

WebAssembly is a faster loading and more generalized version of asm.js. WebAssembly runs in a separate process so it can have a more expressive syntax than JavaScript, but is still part of the same JavaScript virtual machine.

Eich focused on some of the features he is most excited to see land in the language as early as next year:

  • TC39 BigInt - New value type to handle arbitrary precision integers, with support for TypedArrays
  • Dynamic import() - ES Module imports by default are static, and this also allows for prefetching
  • Array.prototype.flat / flatMap - arbitrary flattening of an array, and the solution to flatten and smooshgate
  • More destructuring - for arbitrary objects and arrays
  • Private methods and accessors in Classes - per Eich, the # symbol prefix is a bit controversial and may not happen
  • Async iteration - for await of syntax
  • Several RegExp improvements

See the full list of TC39 proposals for information on these proposals and more.

Crockford spends his time questioning our deep assumptions and how they impact our progress. For example, should we start counting with zero or one, and explains why he believes everything should begin with zero.

Crockford notes that the biggest disappointment thus far with ES2015 implementations is the lack of proper tail calls or tail call optimization, with only Safari having implemented this portion of the specification thus far. According to Crockford, tail calls are the most important feature added to ES2015, as this feature helps support tail recursion, the functional alternative to iteration, as well as continuation passing.

Crockford believes that pure functions are the most critical thing in the language going forward and that anything that impacts pure functions should not get considered for the language.

There are many things that Crockford dislikes in JavaScript. For example, he dislikes async/await because it blocks developers from understanding async programming by making it look sync in nature.

Crockford explained his perspective on simplicity, "The Simpler the standard, the less there is to agree on, and the more likely is it to make interoperability possible." He gave JSON as an example, explaining that JSON is a syntax; it says nothing about behavior, and it is simple to understand and use. The entire grammar of JSON fits on the back of a business card.

Crockford is working on a new language and transpiler called neo that delivers just Crockford's new good parts, in a new language, that transpiles to his definition of good JavaScript, which he expects to release soon along with a forthcoming book titled "How JavaScript Works."

During the question and answer portion of the talk, Eich got asked about the binary-ast proposal, which is something between traditional JavaScript and WebAssembly in that it provides a binary syntax tree for all of JavaScript.

Eich considers binary-ast to be a potentially pragmatic approach but is waiting to get convinced of its benefits through an initial implementation and subsequent performance metrics. Mozilla is working on an initial implementation. Potential risks would include it being another security attack vector, and it just encouraging developers to write larger JavaScript codebases, rather than relying on tools and discipline to optimize their codebase.

When asked about type systems such as TypeScript, Eich remarked that the convenience of dynamic programming is convenient, and a type system that doesn't get in the way is a good idea. Eich notes that "People are used to type systems that don't pay their way."

TypeScript was brilliant as it's a strict superset of JS. Every JS program is a TS program. Anders Hejlsberg is top notch.

Crockford was also asked about TypeScript, but has a much less favorable opinion: "It doesn't solve problems that I have." This dismissal of TypeScript was somewhat contradictory with his earlier statement that "interfaces between things are where errors typically happen", as one of the main benefits of TypeScript is to help define interfaces to prevent these errors.

Eich got asked about possibly standardizing things like React. He noted how early libraries like Dojo and Prototype had concepts that made their way into later versions of the language, but that "We never just standardize a library like React." Instead, efforts are made to lift the essential primitives out of the libraries into the core language. Eich noted that we could get into trouble by standardizing early, especially for tool time solutions like type systems.

Eich got asked for his opinion on the Observables proposal based on RxJS Observables. He notes that the specification has stalled and that it's a challenge to get what should get built into the language, and he is not sure if Observables should get added to the language. He did not mention that the WHATWG specification for streams is a superset of Observables, and perhaps the competition between these two proposals may be blocking progress on the Observables proposal.

Finally, Eich was asked about machine learning, and noted that while deep learning is useful, it does not tell us anything about causality, and today's efforts are just an advanced form of curve fitting algorithms.

The full videos of these conference talks are available with free registration:

Rate this Article

Adoption
Style

BT