JavaScript: Skeletons in the Closet

Allen Wirfs-Brock @awbjs www.wirfs-brock.com/allen [email protected] JavaScript: the world’s most widely used

Stack Overflow 2019 Developer Survey: 69.7% of professional developers use JavaScript How a sidekick for Java, created at in a ten- day hack, ships first as a de facto Web standard and eventually becomes the world's most widely used programming language. JavaScript Prehistory Mosaic released Tim Berners-Lee’s first Web for Microsoft Production browser is completed Windows release of 11 November, 1993 25 December, 1990 Netscape’s browser Alpha release of (Navigator 1.0) Mosaic (Unix) December 15 1994 June 1993

1990 1991 1992 1993 1994 1995

September 1994 7 August, 1991 First public beta December 1992 Tim Berners-Lee public and of Netscape’s announcement of the start browser “WorldWideWeb” development of NCSA Mosaic browser April 1994 Jim Clark and Marc Andreessen found Netscape Communications Corp. 1995: JavaScript Year 0—Getting Started

Netscape recruiting to "Do Scheme in browser" Netscape strategizing about Scripting languages and Java

Sun guerrilla marketing of Java

Netscape announces licensing Java for browser 23 May Brendan Eich joins Netscape April 1995

01 02 03 04 05 06 07 08 09 10 11 12

April 1995 Java alpha release “Come put Scheme into the browser” ... but, does Netscape need scripting? April 1995 Planning for Netscape 2 beta in September 1995

Assuming Netscape would license Java Marc Andreessen Brendan Eich Microsoft is coming

• Why was another language needed? • How to explain reason for two languages? • Did Netscape have the necessary skills? Bill Joy Mocha in 10 days May 6-15(??), 1995 • Brendan, go prove Netscape can do it! • What did Brendan actually build: – Parser – – Decompiler – Basic library – Browser-hosted REPL interface

1995: JavaScript Year 0—Creating a Language Mocha prototype created in 10 days 6 May - 15 May Eich fixing beta Mocha/DOM bugs+Livewire integration

Eich refining Mocha and developing DOM0 Microsoft explores reverse engineering LiveScript

Mocha Netscape 2.0 beta Netscape/Sun demo 1 LiveScript & Java JavaScript PR 16? May 18 Sep 4 Dec

01 02 03 04 05 06 07 08 09 10 11 12

16 Aug 22 Nov Internet Explorer 1.0 IE 2.0 ships May 1995 ships for Win95 5 Dec Bill Gates Internet Microsoft announces Visual Tidal Wave memo Basic Scripting intent Features not in JavaScript 1.0 • A global binding for the identifier undefined • do-while statement • switch statement • try-catch-finally statement • labeled statements; break/continue to label • === operator • typeof , void, delete, in, and instanceof operators • Nested function declarations • Function expressions/anonymous functions More Features not in JavaScript 1.0

• Prototypal inheritance; no prototype property on functions and built-in constructors • Function call and apply methods • A distinct Array object type • Array literals • Object literals • Regular expressions • Garbage collection “Make it look like Java”

Features actually came from • • Java Date • AWK • (Perl) • (Scheme & Self) • (Python) Classes?? Brendan Eich 2016: “Sun (represented by Bill Joy) would not have accepted [in 1995] classes, as in Java’s nominal OO types, in JS. They wanted a sidekick language that did not include too much from Java itself.” https://www.quora.com/Why-didnt-JavaScript-adopt-the-object-oriented-model-adopted-by-C++-Java-when-it-was-designed/answer/Richard-Eng-1/ comment/25744373# Define objecting in JS 1. 0 Coercion and ==

Also coercion of empty string to 0 provided a default numeric value for empty fields of HTML forms. JavaScript 1.1/Netscape 3 (Shipped August 1996) • Added prototype inheritance including constructor prototype properties. • Fixed built-in constructors • Array class with special length property and join, reverse, sort methods • Object coercion protocol: toString and valueOf methods • Number constant methods: MIN_VALUE, MAX_VALUE, etc. JavaScript 1996—Competition

Brendan Eich works completing Mocha as JavaScript 1.1 Brendan Eich disappears for 2 weeks and creates SpiderMonkey/JavaScript 1.2

Netscape 2.0 and Livewire Netscape 3.0 Server ship with ships with Netscape 4 beta 1 JavaScript 1.0 JavaScript 1.1 with SpiderMonkey 18 Mar 19 Aug December 1996

1995 01 02 03 04 05 06 07 08 09 10 11 12 1997

January 1996 29 May 13 Aug 21 Nov Internet Explorer 3.0 Jan 97 Java JDK 1.0 IE 3.0 ships Ecma TC39 release beta1 with JScript and with JScript 1.0 JScript VBScript JavaScript 2.0 standardization startup meeting SpiderMonkey/JS1.2 — Brendan’s 2nd Sprint Beta Dec 1996, Netscape 4 June 1997 How to do a standard?

Netscape/Sun December 1996 press release1: “Netscape and Sun plan to propose JavaScript to the W3 Consortium (W3C) and the Internet Engineering Task Force (IETF) as an open Internet scripting language standard.”

Robert Cailliau2: “I was convinced that we needed to build-in a programming language, but the developers, Tim [Berners- Lee] first, were very much opposed. It had to remain completely declarative.”

1: https://web.archive.org/web/19970614002809/http://home.netscape.com:80/newsref/pr/ newsrelease67.html 2: http://en.wikinews.org/wiki/Wikinews_interviews_World_Wide_Web_co-inventor_Robert_Cailliau

Attendees TC39 organizing meeting November 21-22, 1996 Base document contributions st Key decisions at 1 TC39 meeting

• Use Microsoft specification as base document • Limit initial standard to JS 1.1 functionality • Focus on the language – no web feature • Finish within 6 months ES1 Core Technical Working Group

Guy Steele

Shon Katzenberger Brendan Eich What shall we call this langauge we are trying to standardize? JavaScript • Jan. 14-15, 1997 meeting – CoolScript, CoScript, Descartes,DeScript, DynaScript, Escript, EZScript, InfoScript, JScript JustScript, JSL, LiveScript, RadScript, ScriptJ, TranScript, W3Script, Wscript,wwwscript, Xpresso/Expresso/ Espresso – TC39: Sun/Netscape please let us use Java/LiveScript • Feb 19, 1997 meeting – Sun: nope. Netscape: maybe...nope (May) • June 1997 ECMA GA, what’s the name?!! • July 1997 —RDScript or ECMAScript?? • September 1997 — It’s ECMAScript ECMAScript 1–3 Timeline

Exception Handling Alternatives Waldemar Horwat , March 1998: “At a bare minimum you should be able to write code that works in ECMAScript 1.0 and 2.0 [ES4]. Full backwards compatibility would be rather painful.” ECMAScript Phase 2 The Reformers Wander in the Desert

Sep 1998–Jul 2003 Jun 2002–Dec 2005 Sep 2005–Jul 2008 ECMAScript 4 (attempt one) 1909–2003

JScript.NET JavaScript 2.0 Microsoft Netscape/AOL • Class-based nominal types • Class-based nominal types • Static type checking • Dynamic type checking • Lots of other stuff • Lots of other stuff ActionScript 2&3 Macromedia Flash • Really wanted Java • Class-based nominal types • Static type checking • Not Web compatible ECMAScript 4 (attempt two) 2005–2008

Macromedia/Adobe ECMAScript 4 (take 2) λ Academic CS Brendan Eich Researchers Browser Game Theory • Breaking-changes (even bug fixes) drive away users • New browsers must conform to what is already there • Innovation is wasteful if only present in one browser • First browser to try something new may actually lose market shareDon’t break the Web! ECMAScript Development Timeline

AP Wire Story December 5, 1995 JS 1.0 Properties Access Oddity Brendan Eich–Q1 1996

I hope it [JavaScript] will be implemented by other vendors, based on the spec that Bill Joy and I are working on. I'd like to see it remain small, but become ubiquitous on the web as the favored way of gluing HTML elements and actions on them together with Java applets and other components. ... I haven't studied JavaScript usage rigorously. For all I know, the most common use is to make pages a little smarter and more live --- for instance, make a click on a link load a different URL depending on the time of day.

Brendan Eich interview February 1996 JavaScript 1996

Brendan Eich works completing Mocha as JavaScript 1.1

Netscape 2.0 and Livewire Netscape 3.0 Server ship with ships with JavaScript 1.0 JavaScript 1.1 18 Mar 19 Aug

1995 01 02 03 04 05 06 07 08 09 10 11 12 1997

January 1996 29 May 13 Aug Java JDK 1.0 Internet Explorer 3.0 IE 3.0 ships Jan 97 release beta1 with JScript with JScript 1.0 JScript and VBScript 2.0

1998 TC39 Technical Working Group ES3 Features not in pre-1998 browsers • Global undefined • try-catch-finally and exception objects • instanceof and in operators • Object.prototype methods: hasInstance, hasOwnProperty, isPrototypeOf, propertyIsEnumerable • toFixed, toExponential, toPrecision • URL handling functions • Unicode characters in identifiers • Basic I18N methods, toLocaleString, localeCompare, toLocaleLowerCase, toLocaleUpperCase, Date toLocaleDateString, toLocaleTimeString Classes kept fighting to get back in

Presented at 1st TC39 meeting, November 1996Draft for ECMAScript 1st Edition, February 1997