JavaScript: Skeletons in the Closet Allen Wirfs-Brock @awbjs www.wirfs-brock.com/allen allen@wirfs-brock.com
JavaScript: the world’s most widely used programming language Stack Overflow 2019 Developer Survey: 69.7% of professional developers use JavaScript
How a sidekick scripting language for Java, created at Netscape 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 Production Tim Berners-Lee’s first Web for Microsoft release of browser is completed Windows 11 November, 1993 Netscape’s 25 December, 1990 browser Alpha release of (Navigator 1.0) Mosaic (Unix) December 15 1994 June 1993 1995 1990 1991 1992 1993 1994 September 1994 7 August, 1991 First public beta December 1992 Tim Berners-Lee public Marc Andreessen and of Netscape’s announcement of the Eric Bina start browser “WorldWideWeb” development of NCSA April 1994 Mosaic browser Jim Clark and Marc Andreessen found Netscape Communications Corp.
1995: JavaScript Year 0—Getting Started Netscape recruiting Brendan Eich 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 Brendan Eich Marc Andreessen 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(??), 1996 • Brendan, go prove Netscape can do it! • What did Brendan actually build: – Parser – Bytecode interpreter – Decompiler – Basic library – Browser-hosted REPL interface
1995: JavaScript Year 0—Creating a Language Mocha prototype created in 10 days Eich fixing beta Mocha/DOM 6 May - 15 May bugs+Livewire integration Eich refining Mocha and developing DOM0 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
1995: JavaScript Year 0—Creating a Language Mocha prototype created in 10 days Eich fixing beta Mocha/DOM 6 May - 15 May bugs+Livewire integration Eich refining Mocha Microsoft explores reverse and developing DOM0 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 IE 2.0 ships Internet Explorer 1.0 for Win95 May 1995 ships 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 • C • 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.
JS 1.0 Properties Access Oddity
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 Brendan Eich works completing Mocha as JavaScript 1.1 Brendan Eich disappears for 2 weeks and creates SpiderMonkey/JavaScript 1.2 Netscape 2.0 Netscape 3.0 and Livewire ships with Netscape 4 beta 1 Server ship with JavaScript 1.1 with SpiderMonkey JavaScript 1.0 18 Mar December 1996 19 Aug 1995 1997 01 02 03 04 05 06 07 08 09 10 11 12 January 1996 29 May 13 Aug 21 Nov Internet Explorer 3.0 Jan 97 Java JDK 1.0 IE 3.0 ships Ecma TC39 beta1 with JScript release with JScript 1.0 JavaScript JScript and VBScript 2.0 standardization startup meeting
SpiderMonkey/JS1.2 — Brendan’s 2 nd Sprint Beta Dec 1996, Netscape 4 June 1997
How to do a standard? Netscape/Sun December 1996 press release 1 : “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 Cailliau 2 : “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 Ecma International TC39 organizing meeting November 21-22, 1996
Base document contributions
st TC39 meeting Key decisions at 1 • Limit initial standard to JS 1.1 functionality • Focus on the language – no web feature • Use Microsoft specification as base document • 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 (take one) 1909–2003 JScript.NET JavaScript 2.0 Netscape/AOL Microsoft • 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 (take 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 share Don’t break the Web!
ECMAScript Development Timeline
Recommend
More recommend