EcmaScript 4 was too far ahead of its time

Pier Bover
Oct 14, 2016 · 3 min read

When we say Flash what most people really mean is the browser plugin, right? Or you know, maybe the superhero.

But Flash was, still is, an ecosystem which includes stuff like Adobe Air, Animate CC, and most importantly the language ActionScript 3 (AS3).

You might be wondering why the hell I’m writing about Flash after luring you with this title. I am sorry, but I assure you it will make sense in a few more lines.

There and back again

Adobe gave birth to AS3 in 2006 based on EcmaScript, the same specification Javascript follows, which introduced a number of awesome non spec-compliant features. Some time later there was a proposal for EcmaScript 4 based on AS3, but the proposal was abandoned in 2008 by committee TC39.

One version I’ve found is that it was feared that EcmaScript 4 would not get sufficient adoption. It was an ambitious proposal, but with ambition comes change, or in technical jargon breaking changes.

The other version, the juicy one, is that EcmaScript 4 was a political problem. Adobe was behind AS3 and TC39 was formed by members from other corporations such as Microsoft. Back in 2008 Chrome was a few months away from its first release, and there was this thing called Silverlight which was trying to compete with the Flash Player for the interactive rich media podium.

In any case, TC39 decided that efforts should be focused on an incremental upgrade with backwards compatibility. This resulted in EcmaScript 5 (ES5) a few years later which is still the most extended version in current browsers.

You can read more about the TC39 and EcmaScript 4 saga here, and here.

So what was so great about AS3 back in 2006?

Classes
AS3 had real classes with access modifiers, a feature that is still missing in ES6 or even Es7 as far as I know. We were writing components in AS3 before Facebook even existed.

Types
I cannot emphasize this enough. Writing OOP code without types is like driving a real car vs playing with RC cars. TypeScript, which is all the rage these days, was basically created to get a real type implementation which JS still lacks.

Interfaces
Yep, AS3 had interfaces too like other “serious” languages such as Java or C#. TypeScript implemented those too.

Modules and packages
We now have imports in ES6, but those are still quite primitive. For example in AS3 you could import all the classes from a folder or package by simply using:

import api.modules.*;

This would be handy for example in those never ending React Router configuration files, where each and every React component has to be explicitly imported. I reckon this would have implications other than just the syntactic aspect, but still.

Default function parameters
A nice feature that was only recently added in ES6.

AOT
Or ahead-of-time compilation. One of the nifty new advanced features in Angular.

Real constants
As in, something that cannot change during runtime.

Enums
Enumerated types are bread and butter stuff in pretty much any language, except Javascript. Not even in ES7 as far as I know. Another essential feature TypeScript implemented.

And remember. We had those features 10 years ago.

Is AS3 dead?

Yes pretty much, which is a shame really. Writing AS3 was in many aspects much more advanced than writing Javascript in 2016. Any serious Flash dev will tell you that.

The real sad part is that AS3 didn’t die because it was a bad language, on the contrary, it’s one of the best things Adobe has ever made. It died because of the Flash Player stigma.

Some people saw this and created haxe, a language and toolkit inspired by AS3, or the haxe based OpenFL library / game engine that can be used to output JavaScript. There is also AS3JS, an obscure project for transpiling AS3 to Javascript which I even funded for some time in Patreon. That pretty much sums the legacy of AS3 / EcmaScript 4 in the programming world.

What if…

I love Javascript, ES6, even Webpack (yeah). I’m really in love with arrow functions and async/await, features that AS3 never had and never will.

But, just imagine for a moment…

Where would Javascript be now if EcmaScript 4 had been implemented back in 2008?

That is all.

More From Medium

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade