Brendan Eich: JavaScript 2 and the Future of the Web. In a nutshell: a bunch of new syntax, optional type annotation, more keywords borrowed from Java, and a huge lurch in the direction of Python. “Standard global properties (Date, String, etc.) immutable” is listed on the “Bug Fixes” slide; if that means what I think it means, I’m gonna be angry.
Comments
Don’t believe the infoworld piece — the reporter made up some words and put them in my mouht, totally blowing the degree of Pythonic imitation out of proportion.
We are planning on adopting Python-style iterators, generators, and array (list in Python) comprehensions, but that’s it. This is not a lurch, not only because it’s confined to one area (iteration) — it’s also not a lurch because JS and Python have similar design goals and limits. And these features, while following Python 2.5 fairly closely, will not use exactly the same names as Python uses (e.g. Iterator for iter).
What do you think making global properties immutable means? It does not mean making Date the constructor function immutable, or making the Date.prototype object immutable (but Date.prototype, the property, is already immutable — readonly and “don’t-delete”, in JS1 / ES3 today). It means making the binding of “Date” in the global object immutable.
/be
Brendan, sorry if it sounded like I was going on a rant. I’m relieved to hear that the prototypes of core objects will still be mutable. It was ambiguous to me because I didn’t have the benefit of being at the panel. Plus lately I’ve been a bit sensitive to things in JavaScript that I consider features but that others consider bugs.
In the past few months, it seems like the Ruby/Python “philosophy differences” (language wars) are creeping into the realm of JavaScript: Dojo/MochiKit on one side and Prototype/Scriptaculous on the other. The Python side claims that modifying the core objects is bad practice, and I get where they’re coming from, but on the other hand I think sticking everything into its own namespace creates arbitrary differences (e.g.
getElementsByClassName
isn’t really different fromgetElementsByTagName
, so why treat it differently?). This is something that’s been churning in the back of my head for a while and I could devote a lengthy post to it if I wanted to.In short, thanks for making this an exciting time to be a client-side developer. I’ll be an enthusiastic supporter of JavaScript 2 as long as it enables multi-paradigm programming the way that JS1 does. (Oh, and while I’ve got your attention, about the whole
Object.prototype
thing…)