Why Was There No ES4? The Untold Story of JavaScript’s Missing Version
This article explores the history of the abandoned ECMAScript 4 specification, detailing its ambitious features, the industry conflict that halted its release, and how many of its ideas later resurfaced in modern JavaScript versions like ES6.
When building applications you often see target ES versions such as ES3, ES5, ES6, or even ES10, but ES4 is missing. This article explains why.
ES4 Brief History
According to Wikipedia, ES4 drafting began in February 1999 and was planned for completion in August 2008. The proposal introduced many groundbreaking features—classes, strict typing, modules, etc.—which would have caused massive compatibility costs for the JavaScript ecosystem at the time.
Because the changes were too radical, major browser vendors (Yahoo, Microsoft, Google) opposed a large‑scale upgrade and advocated incremental changes, while Mozilla, led by Brendan Eich, supported the draft.
In July 2008, ECMA temporarily halted ES4 development, discarding the version. A small subset of improvements became ES3.1 (later renamed ES5), and the more aggressive ideas were postponed to future versions under the code‑name “Harmony”.
What Was in the ES4 Draft?
Classes
Classes were defined long before ES6 implemented them:
<code>class Bar {
var val = 1
const pi = 3.14
// A function
function f(n) {
return n + val * 2
}
// Getters and setters
function set foo(n) { val = n }
function get foo() { return val }
}
</code>The syntax differs slightly from ES6 and notably lacks
this. Additional class keywords included
static,
final,
private,
protected,
public, and
prototype.
Interfaces
ES4 introduced interfaces similar to TypeScript:
<code>interface MyInterface {
function foo();
}
</code>Strict Typing
Strict type checking was added:
<code>function add(a: int, b: int): int {
return a + b;
}
</code>Union types were also supported:
<code>// typescript
var a: number | string;
// es4
var a: (number, string)
</code>Generics were possible:
<code>class Wrapper<T> {
inner: T
}
</code>Like Keyword
The
likekeyword allowed looser type constraints:
<code>function getCell(coords: like { x: int, y: int }) {
}
</code>This suggests ES4 used nominal subtyping rather than structural subtyping.
Nominal subtyping: types are compatible only when explicitly declared (e.g., C, Java).
Structural subtyping: compatibility is based on shape (e.g., TypeScript).
New Types
Beyond existing types (
boolean,
object,
array,
number,
BigInt), ES4 planned additional primitives such as
byte,
int,
unit,
double, and
decimal. The
msuffix was also introduced for monetary values.
<code>const allowance = 1.50m
</code>Triple‑Quoted Strings
<code>// ES4
const hi = """Hello my name is Evert""";
// ES6
const hi = `Hello my name is "Evert"`;
</code>This resembles Python’s triple‑quoted strings; ES6 later added template literals.
Packages
Packages acted like modules with a global namespace similar to Java:
<code>package com.evertpot {
// Private
internal const foo = 5;
class MyClass {
}
}
</code>Usage examples:
<code>const myObj = com.evertpot.MyClass;
// or
import * from com.evertpot;
const myObj = MyClass;
</code>Generic Functions
The
generickeyword allowed function overloads at runtime, unlike TypeScript’s compile‑time overloads:
<code>class Foo {
generic function addItem(x);
function addItem(x: int) {}
function addItem(x: number) {}
}
</code>E4X
E4X (ECMAScript for XML) enabled embedding XML directly in code:
<code>const myClass = 'welcome';
const name = 'Evert';
const foo = <div class={myClass}>{"Hello" + name}</div>;
</code>It influenced JSX syntax; E4X was removed from Firefox after version 10.
More Features
Other planned features included block‑scoped
letand
const, generators with
yield, and various asynchronous constructs.
Afterword
Many ES4 concepts were ahead of their time. Although the version never shipped, several ideas survived and were eventually realized in ES6, shaping today’s JavaScript landscape.
Article translated and compiled from https://evertpot.com/ecmascript-4-the-missing-version/
WeDoctor Frontend Technology
Official WeDoctor Group frontend public account, sharing original tech articles, events, job postings, and occasional daily updates from our tech team.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.