Live data from Hacker News

The State of JavaScript - Brendan Eich

brendaneich.github.com

141–150 of 266 posts

Re: The State of JavaScript - Brendan Eich

#141

Aside from my personal distaste for his backing up the semantic truck and dumping it into ES6, I think it's a bit annoying -- to the point of being disrespectful -- that Brendan doesn't mention V8 in his history of JavaScript. Without V8, there is no JavaScript on the server-side (sorry, Rhino and SpiderMonkey), there is no Chakra and there is no TraceMonkey/JagerMonkey/IonMonkey: given that JavaScript had survived f…

Howdy, Bryan. A few comments.

First, it's not all about _moi_. As with any mature language with multiple implementations, there is a committee, Ecma TC39. It has reps from all the bigs plus PayPal (Doug Crockford) and Yahoo!. We avoid design by committee, instead focusing on paving the cowpaths and in a few cases working with champions -- single innovators or RPG's "resonant dyads" _a la_ ken&dmr -- to do focused design. The best example in my view is the Proxy design by Mark Miller and Tom Van Cutsem, followed by Modules by Dave Herman and Sam Tobin-Hochstadt.

We have a few goals, including minimizing kernel semantics and extending syntax for usability only where we have experience and positive user-testing results (e.g., destructuring, let, generators, classes as prototypal sugar a la CoffeeScript).

In this light, we aren't dumping new semantics into ES6. If you count fairly, we are filling the big semantic gaps in ES5 (AKA JS as we know it). For instance, where is client-side synchronous "require" without the ES6 module system? No fair that Node's require is sync (against all sound doctrine!). Sync XHR is from the jank-devil, and we cannot do sync require as an API client side.

Second, as others have noted, V8 was stealth'ed for two years (I learned of it in 2006 but Google withheld, see https://brendaneich.com/2011/06/new-javascript-engine-module...) and then unleashed just as Apple and Mozilla got their JIT acts together. At the time some said V8 was 3x faster, but the actual ratio on stupid benchmarks was more like 1.3x at first.

V8 is an amazing piece of work, but it did not contribute to the language evolution that my "very brief history" slide diagrammed. It certainly contributed by being the fastest, but until after 2010, that was the extent of its influence, for several specific reasons.

For the first few years as open source, V8 foreswore diverging from JavaScriptCore (the first WebKit engine, Apple's fork of KJS from KHTML, which V8 in some ways forked WebKit to replace) on any new ES5 or ES6 proposals, to try to keep on (or get back on, in view of the fork) Apple's good side. Fat chance!

Even now, V8 still keeps prototyped ES6 implementations hidden behind a flag. I expect this flag to be lifted before ES6 is ratified.

Another thing that hurt: Google has moved V8 to Munich because the Aarhus team wanted to do Dart, Google explicitly chose to invest in Dart over JS, and the no-remote-teammates rule hurt. IMHO the Munich team is quite strong but only ~10 people. This limits its effectiveness compared to Chakra (~60 heads?) and even SpiderMonkey (~12, more with interns).

Finally, whoever thinks I disrespect V8 clearly does not listen to my talks. The video will be up, give it a view when it's live if you have time. There is no disrespect from me toward V8 or the team that built it. I do mention it favorably in all talks, including Strange Loop (if my memory serves).

Lars Bak did the Strange Loop first night closing keynote, which my insane schedule prevented me from attending. He and I have had no meetings since that one in 2006, although he met with some Mozilla colleagues in 2009. I bear no bad feelings, although Lars did tell a gratuitous whopper around 3:50 in this talk: http://www.youtube.com/watch?v=T2TJYBmDZHI (see my blog cited above for what happened with Mozilla being "offered" V8 in 2006 -- Google reneged). He is the best VM hacker I know of. (Mike Pall is another superhacker of note.)

I hope this sheds some light. I respect V8 while noting that, as with anything human, it and the technical/product/open-source/standards politics around it show some significant flaws. That is inevitable.

Mozilla has flaws too, but they tend to be different in kind. For example, we do open from the start and try to partner even against long odds (e.g., Tamarin/ES4). I'm not bragging, because I think that can be a mistake. I've learned from V8 and modified Mozilla strategies accordingly.

So, hats off to V8!

Re: The State of JavaScript - Brendan Eich

#142

Earlier quoted context omitted.

You seem to misunderstand "structs" -- see http://wiki.ecmascript.org/doku.php?id=harmony:binary_data , this is an extension of WebGL's typed arrays, which are already in all the new browsers (IE10 too). As for implicit coercions, I enjoyed Gary Bernhardt's "Wat", referred to it, and at past talks even mocked along with. At Strange Loop, I went through each "Wat" in the "Wat Secrets Revealed" slide series (use down a…

May be off-topic but: Is it just me, or are macros just a new way to get confused while reading JavaScript? Introducing language-foreign syntactic constructs seems to me superfluous and confusing - This is the job of transcompiling languages like CoffeeScript.

Reading the macros first helps. They must be defined at top of program or module, if I recall sweetjs.org's design correctly, for the staged hygienic expansion to work well.

Aside from that, you're right. But JS has higher order functions and objects with ad-hoc methods, so it can be used according to many paradigms, which can make it hard for a reader unfamiliar with the dominant paradigm in code at hand.

This is not a deal-killer for macros, although with sweet.js as the prototyping tool, your assertion about "This is the job" is satisfied. Sweet.js works with node to do AOT macro expansion at present. There's effort to integrate it in the browser too, but this will be easier with ES6 module loaders (not yet prototyped in SpiderMonkey or V8).

Re: The State of JavaScript - Brendan Eich

#143

Earlier quoted context omitted.

We gave up on TCP for => function syntax. I think Java reached the same conclusion. It's really hard to retrofit TCP onto a C-like language with statements as well as expressions. At best you please only some programmers and confuse others, at a fairly high implementation cost (e.g., return from within a lambda called after its containing function deactivated). See https://mail.mozilla.org/pipermail/es-discuss/2012-M…

Thanks, it's nice to hear it from the horse's mouth. Does it make sense to think about TCP as being a matter of degree? Would it be correct to say that the number of constructs that would break TCP is fewer with let, const, and => than with earlier versions of ES? I think a "partial TCP" would matter for manual refactoring, if not for (e.g.) a future macro system. On the other hand, perhaps it's more confusing to men…

Saw dherman's comment just now, he and you are right that there is a spectrum of TCP, and if you use a subset of JS to write expression-bodied => functions, you get the refactoring property that people associate with TCP.

Re: The State of JavaScript - Brendan Eich

#144
post #118

Earlier quoted context omitted.

TraceMonkey was announced on 2008-08-23, after 2 months of development[1]. V8 had its first public release together with Chrome 2008-09-02 as you already mentioned, but development appears to have started in 2006 according to some of the copyright notes in the initial SVN export[2]. [1] https://brendaneich.com/2008/08/tracemonkey-javascript-light... [2] http://code.google.com/p/v8/source/detail?r=2

Which seems to confirm there would be a Tracemonkey even without V8 ever existing.

Yes. I did not take Bryan to task on that, but it really gives V8 a bit too much credit for it to cause Andreas Gal to work on trace-JIT before 2006 (on Java, for his UCI PhD; then on JS in collaboration with Adobe and Mozilla).

Tracing was a good rocket to strap on SpiderMonkey-the-2008-era-interpreter but it fell to a combination of the PIC-based approach V8 championed and Brian Hackett's Type Inference work (PLDI 2012, http://rfrn.org/~shu/drafts/ti.pdf).

Re: The State of JavaScript - Brendan Eich

#145

Earlier quoted context omitted.

PNaCl is both not done and (last I checked) not totally machine-independent due to LLVM encodings of machine word sizes. See also http://comments.gmane.org/gmane.comp.compilers.llvm.devel/43... for doubts on the wisdom of using LLVM bitcode for a long-lived, widely-distributed object file format. PNACL is a fine research project, but unfortunately both NaCl and PNaCl are tied to Pepper, a gargantuan API specified now…

There is a wide gap between fully embracing a technology and spreading misinformation about it. I respect Mozilla's decision not to integrate NaCl, to argue that it's premature to talk about doing so while it's underspecified and coupled to Chromium, and to set criteria that it must meet before it will be on the table for further discussion. I can understand concerns about cost and governance and an unwillingness to…

Work with say Khronos group to establish an OpenCPU standard with a source code and possibly intermediate representation.

Socialize amongst CPU vendors, and interest platform makers in the mobile and desktop space.

Watch it absorbed by web standards.

Re: The State of JavaScript - Brendan Eich

#146
post #79
post #66

I would really like support for 64-bit integers and native 64-bit math.

What kind of apps would this help with? JS is never going to take over on the server for me until it can compete with Python's statistics support, I didn't see much in these slides that suggests it could.

Node.js modules and apps that work with C++ libraries/services that return 64bit numbers. Not having 64bit integers is an issue.

Re: The State of JavaScript - Brendan Eich

#147
post #35

Aside from my personal distaste for his backing up the semantic truck and dumping it into ES6, I think it's a bit annoying -- to the point of being disrespectful -- that Brendan doesn't mention V8 in his history of JavaScript. Without V8, there is no JavaScript on the server-side (sorry, Rhino and SpiderMonkey), there is no Chakra and there is no TraceMonkey/JagerMonkey/IonMonkey: given that JavaScript had survived f…

> Without V8, there is no JavaScript on the server-side The first implementation of server side Javascript was nearly 20 years ago: http://en.wikipedia.org/wiki/JavaScript#Server-side_JavaScri... Naturally, it was never all that popular, but... it has been around.

He meant server-side JS was relatively non-existent before node.js, he even listed alternate server-side JS impls that did use server-side JS, nothing of which is anywhere close to the phenomenon that node.js is now.

Re: The State of JavaScript - Brendan Eich

#148

This presentation saddened me. The presentation focused on what it perceived as missing features: structs (seriously?), classes, modules, syntactic sugar, macros, etc. But the huge gaping holes in Javascript are not missing features. They are fundamental errors in the language. Things like ==, numbers as strings, eval, incorrect definitions of false, semicolon insertion, and -- heaven help us all -- improper lexical…

I think you're being too hard on JavaScript there. Type coercion, ASI, and function scoping are all language features, not errors. Likewise, eval is not an error; it's dangerous, but it's also a feature (and one that nearly all dynamic/scripted languages provide). As Crockford said, "JavaScript is the only language people feel like they don't need to learn to use." That statement alone describes why so many developer…

Eval sure, but the way that type coercion works in Javascript is an error. Boxing in Javascript is an error. You can figure them out, you can code around them, but they are bad and can't be justified. All coercion isn't bad, but some is.

Have you seen code that uses .valueOf() for anything good or useful? new String()?

Re: The State of JavaScript - Brendan Eich

#149

Earlier quoted context omitted.

PNaCl is both not done and (last I checked) not totally machine-independent due to LLVM encodings of machine word sizes. See also http://comments.gmane.org/gmane.comp.compilers.llvm.devel/43... for doubts on the wisdom of using LLVM bitcode for a long-lived, widely-distributed object file format. PNACL is a fine research project, but unfortunately both NaCl and PNaCl are tied to Pepper, a gargantuan API specified now…

There is a wide gap between fully embracing a technology and spreading misinformation about it. I respect Mozilla's decision not to integrate NaCl, to argue that it's premature to talk about doing so while it's underspecified and coupled to Chromium, and to set criteria that it must meet before it will be on the table for further discussion. I can understand concerns about cost and governance and an unwillingness to…

You are still being free with accusations of spreading misinformation and other evils. If you want to have a real exchange, cool it! Just try to imagine how a hardball from me casting aspersions on you for suspected bad or unfair (to Mozilla; "fair" to Google) motives might feel.

Thanks for the PNaCl pointer. My comment was based on LLVM bitcode having machine word size dependencies. This was an issue a while ago. I should have checked to see if it remained one.

This correction doesn't alter the general unreadiness of PNaCl for the web, on several fronts. Pepper is one, but PNaCl performance lagging NaCl is another. The Chrome Web Store features games ported via NaCl, for performance -- not PNaCl, which would be significantly slower. On this basis alone, it's premature for you to push PNaCl ahead of Google.

> This is a far more reasonable and compelling story.

Well, gee, thanks a ton! :-|

I've been telling this story clearly since Fluent in May. That you chose not to hear it and instead flung accusations and told sob-stories about big bad Mozilla is your doing, not mine.

Here's a final clue: all browser vendors, definitely including Chrome, make the rule (not an argument) "no one gets to the machine except through our VM(s) and GC(s)" -- outside of a few dying plugins, which are even source-licensed and co-released.

And that brings back my final point: NaCl is for safer plugins, which are OS-specific anyway. The likeliest evolution of SFI or CFI enforcing compilers and runtimes as plugin hosts is via the OS, not the browser. Write a letter to Microsoft and Apple, not to Mozilla!

Re: The State of JavaScript - Brendan Eich

#150

Earlier quoted context omitted.

Taking your points one at a time: 1) If PNaCl ever happens and is not directly tied to Chrome's internals (which it is at the moment), the discussion can be revisited. 2) Google is opposed to anyone else being more involved in the process. Other people have tried. 3) Mozilla has no particular concerns about "losing face" if a pragmatic decision is needed. We're a lot more worried about consequences for users and the…

> Calling "NaCL" an "open technology" is about on par with calling Silverlight an "open technology", for what it's worth. Silverlight is closed-source, patent-encumbered, and released by a company with a history of "embrace, extend, extinguish." That someone who appears to be speaking for Mozilla would draw this comparison is, again, disappointing. > If PNaCl ever happens and is not directly tied to Chrome's internal…

So this is why my ears felt warm this morning.

Yeah, even though I don't work at Mozilla anymore, I still think {P}NaCl is a bad idea for the web as a whole (and its users, by effect) and also for Mozilla (as one of its most important stewards.)

Carry on.

Post reply on HN