
The Birth and Death of JavaScript [video] - gary_bernhardt
https://www.destroyallsoftware.com/talks/the-birth-and-death-of-javascript
======
jliechti1
For those unfamiliar, Gary Bernhardt is the same guy who did the famous "Wat"
talk on JavaScript:

[https://www.destroyallsoftware.com/talks/wat](https://www.destroyallsoftware.com/talks/wat)

~~~
liviu
Brendan Eich covered this subject at O'Reilly Fluent conference in 2012:

[http://youtu.be/Rj49rmc01Hs?t=5m7s](http://youtu.be/Rj49rmc01Hs?t=5m7s)

~~~
1stop
Seems he took the Wat talk a little personally, but I'm not sure why he
defends {} + [] by saying the first { is a statement... wat?

~~~
drostie
It's because they wanted to say both:

    
    
        if (a) b;
    

and

    
    
       if (a) { b; c; }
    

which tends to make you think of curly braces as a syntactic feature which can
appear _anywhere_ , turning many lines of code into one line of code. If you
think that way then these should possibly also be valid:

    
    
        {b; c}
        {b}
        {}
    

but, since JS scope is function-oriented and in other places (e.g. functions)
the braces are ultimately needed anyways, even for one-liners, it seems like
this was a stupid choice and we should have just rejected the form:

    
    
        if (a) b;
    

and then the reuse of {} for lightweight (if non-robust) hashmaps would
perhaps be unambiguous again.

~~~
kbenson
Which is exactly what Perl did, but to alleviate the clumsiness of single
statement if conditionals they added a post-conditional if statement of the
form STATEMENT if CONDITION; (which has the benefit of being how some people
express simple conditionals in real life. "Go left if you see the blue
house.")

------
lelandbatey
First, I very much love the material of the talk, and the idea of Metal. It's
fascinating, really makes me think about the future.

However, I also want to rave a bit about his presentation in general! That was
_very_ nicely delivered, for many reasons. His commitment to the story, of
programming from the perspective in 2035, was excellent and in many cases
subtle. His deadpan delivery really added to the humor; the fact that he
didn't even smile during any of the moments when the audience was laughing
just made it all the more engaging.

Fantastic talk, I totally loved it!

~~~
madeofpalk
Also, Java-YavaScript

~~~
robocaptain
It sounds so natural that I immediately started thinking I had actually been
saying it wrong all these years.

~~~
madeofpalk
I think I'm going to adopt this new pronounciation.

~~~
ricket
pronunciation*

(it's one of few weird words that change spelling when you add a suffix, such
as fridge/refrigerator)

------
tinco
The reason why metal doesn't exist now is because you can't turn the memory
protection stuff off in modern CPU's.

For some weird reason (I'm not an OS/CPU developer) switching to long mode on
an x86 cpu also turns on the mmu stuff. You just can't have one without the
other.

There's a whole bunch of research done on VM software managed operating
systems, back when the VM's started becoming really good. Microsoft's
Singularity OS was the hippest I think.[0]

Perhaps that ARM cpu's don't have this restriction, and we will benefit from
ARM's upmarch sometime?

[0] [http://research.microsoft.com/en-
us/projects/singularity/](http://research.microsoft.com/en-
us/projects/singularity/)

~~~
gary_bernhardt
I didn't want to go into this level of detail in the talk, but... I think you
still want the MMU enabled, just not used for process isolation. With virtual
memory totally disabled, a 1 GB malloc takes 1 GB physical memory even if it's
not touched, you can't have swap at all, memory fragmentation kills you dead,
etc. It still has a lot of utility outside of isolation.

I don't have a good sense of how the performance cost of hardware isolation
breaks down into {virtual memory enabled,TLB thrashing,protection ring
switching}. That's one of the reasons that I reduced the speed-up from
"25-33%" in the MSR paper down to 20% in METAL. Maybe the speed-up would be
less than that if virtual memory were still enabled.

Unfortunately, that distinction may have been blurred in the talk. That is, I
may have implied that METAL would turn the MMU off entirely. If so, it was an
oversight. I've done the talk end-to-end at least fifty times, which is how I
smooth my execution out. Occasionally it can "smooth" the ideas out a bit too,
leading to small inaccuracies. It's sort of like playing the telephone game
with yourself (which is a very strange experience).

The MSR paper that I quote came from the Singularity team, so your reference
is right on. Reading "Deconstructing Process Isolation" in fall of 2012 was
probably the germ of the core narrative of the talk.

~~~
microcolonel
There's a new CPU architecture in the pipe(should have good silicon within
five years, if their projections can be trusted), and it has a very good
design around system calls, and also in terms of virtual memory.

It has a single 64-bit address space and only protection contexts, and due to
the general design of the system it doesn't require any register push(or
registers at all, at least in the traditional sense). In addition, it has
primitives which would allow programs to call directly into drivers and kernel
services without a context switch.

Anyway, I don't mean to sound like an advertisement, and we've yet to see any
silicon, so the jury's out.

Aside: Starting process address spaces at 0 is not really a convenience as far
as I know(other than offering consistent addresses for jumping to static
symbols), it's a way to enable PAE on 32-bit machines so that single
contexts(typically processes) can use the whole address space.

~~~
wolf550e
You forgot to provide a link:
[http://millcomputing.com/docs/](http://millcomputing.com/docs/)

------
spyder
Looks like Erlang is already getting one step closer to the metal:

[http://erlangonxen.org/](http://erlangonxen.org/)
[http://kerlnel.org/](http://kerlnel.org/)

Also there is another project that can be related to that goal:

"Our aim is to remove the bloated layer that sits between hardware and the
running application, such as CouchDB or Node.js"

[http://www.returninfinity.com/](http://www.returninfinity.com/)

------
vanderZwan
I guess this is in a way a response to Bret Victor's "The Future of
Programming"?

[https://vimeo.com/71278954](https://vimeo.com/71278954)

~~~
exodust
Thanks for link. Liked the 70s vibe and humour.

From about 14:40 he gets animated, basically conducting! Would love to know a
programmer's explanation for the function or purpose of arm waving and hand
signals in a presentation. Not knocking, just curious!

~~~
guard-of-terra
Well, he just tries to reinforce that we have two symmetrical interconnected
systems and yet they have to figure out how to talk to each other. What he has
on the screen.

------
jerf
It's not far off my predictions:
[https://news.ycombinator.com/item?id=6923758](https://news.ycombinator.com/item?id=6923758)

Though I'm far less funny about it.

------
jongalloway2
Coincidentally, I just released a podcast interview with Gary right after he
gave this talk at NDC London in December 2013:
[http://herdingcode.com/herding-code-189-gary-bernhardt-on-
th...](http://herdingcode.com/herding-code-189-gary-bernhardt-on-the-birth-
and-death-of-javascript/)

It's an 18 minute interview, and the show notes are detailed and timestamped.
I especially liked the references to the Singularity project.

------
mgr86
I'm missing some obvious joke...but why is he pronouncing it yava-script.

~~~
jetsnoc
He's in character of it being 2035 and the pronunciation was lost/changed.

~~~
lomnakkus
I think you're probably right -- he _almost_ slips up at one point, but
corrects himself before pronouncing the "va".

------
cjbprime
For context, this was one of the most enjoyed talks at PyCon this year.

~~~
TazeTSchnitzel
JavaScript at _Py_ Con?

~~~
wiredfool
Yep. It was on the schedule.

~~~
chris_mahan
I think you'll find that the python ecosystem is very large and varied.

~~~
clebio
apropos, Bokeh.

------
granttimmerman
> xs = ['10', '10', '10']

> xs.map(parseInt)

[10, NaN, 2]

Javascript is beautiful.

~~~
just2n
There are so many good WTFs in JS, but this is not one. parseInt expects 2
arguments and Array.prototype.map provides 3 to the callback it is given. Both
of these facts are very well documented and known.

    
    
        var mappableParseInt = function(str){
            return parseInt(str, 10);
        };
    
        ['10', '10', '10'].map(mappableParseInt);
    

I'd suspect this snippet is more a snipe at people who don't know JS very well
and expect parseInt to be base-10 only.

~~~
CatMtKing
You could say it's a snipe at the weak type system that Javascript has.

I dunno, as someone without much experience with Javascript, it is a little
odd that arrays return the index alongside the value by default.

~~~
anaphor
It has little to do with the type system. Variadic arguments can be typed
given a type system that supports it.

------
vorg
I suspect Nashorn, the just released edition of JavaScript for the JVM, will
be heavily promoted by Oracle and become heavily used for quick and dirties
manipulating and testing Java classes, putting a dent into use of Groovy and
Xtend in Java shops. After all, people who learn and work in Java will want to
learn JavaScript for the same sort of reasons.

------
dsparry
Very impressive to have been recorded "April 2014" and released "April 2013."
Seriously, though, great presentation.

~~~
icameron
Agreed! I too was wondering isn't the discovery of time travel the bigger
story here? /s

~~~
saraid216
No, at the end of the day, the discovery of time travel ended up being a
really trivial achievement because of paradox. Now, the scientific knowledge
we picked up en route was monumental, but that's something else.

------
joelangeway
He says several times that JavaScript succeeded in spite of being a bad
language because it was the only choice. How come we're not all writing Java
applets or Flash apps?

~~~
bsder
Because Java, Flash, etc. _couldn 't easily manipulate the DOM_.

Javascript won for this reason.

~~~
TazeTSchnitzel
There were other advantages. To write JS you just need a text editor, and it's
easy to pick up. To write Flash requires spending several hundred dollars. To
write Java requires the JDK and to learn Java.

~~~
Turing_Machine
Flash and Java also required a compile.

Javascript just required that you click refresh.

Especially on 1995 technology, that mattered. Compiling Java took a while. I
didn't use Flash enough to retain an impression of speed, but it sure wasn't
instantaneous.

~~~
muyuu
It's also the reason why Flash was so prevalent until recently and is still
installed in 90-something % of desktop computers: it's faster. Significantly
faster, and very specially so in the 90s and early 2000s.

------
igravious
Stellar stuff. Hugely enjoyable. Very interesting thought experiment. I won't
spoil it for any of you, just go and watch! Mr. Bernhardt, you have outdone
yourself sir :)

------
steveklabnik
Consider the relationship between Chromebooks and METAL.

(I'm typing this from my Pixel...)

~~~
cbhl
Bernhardt later tweeted:

"I gave The Birth & Death of JavaScript seven times and no one ever asked why
METAL wasn't written in Rust."

[https://twitter.com/garybernhardt/status/456875300580651009](https://twitter.com/garybernhardt/status/456875300580651009)

~~~
EdSharkey
It was assumed because that was/will be a foregone conclusion.

------
nkozyra
Extraordinarily entertaining and well presented.

------
Sivart13
Where did you get the footage of Epic Citadel used in the talk?

[http://unrealengine.com/html5](http://unrealengine.com/html5) seems to have
been purged from the internet (possibly due to this year's UE4 announcements?)
and I can't find any mirrors anywhere.

Which is a shame, because that demo was how I used to prove to people that
asm.js and the like were a Real Thing.

~~~
sefjklsffsdfjkl
[https://web.archive.org/web/*/https://www.unrealengine.com/h...](https://web.archive.org/web/*/https://www.unrealengine.com/html5)

~~~
Sivart13
Not Sure If Serious, but this doesn't work at all in any browser I've tried it
in. I don't think archive.org especially knows how to mirror a giant weird
experimental single page app.

------
atmosx
I have a question, because this video confused me. I don't have background to
follow through all the assertions Gary Bernhardt did, but I'll try to watch it
again, since it was fun.

I want to become a full stack developer. I can program and write tests in
ruby, I can write applications using Sinatra and now I am learning rails. I
bought a book to start learning JavaScript because it's the most popular
language and basically will allow me to write _modern_ applications. After I'm
done with JS I'll probably jump into something else (rust, go, C, C++, Java,
whatever helps do the staff I want).

But watching this video, I'm confused: I avoided CoffeScript because I read in
their documentation that in order to debug the code you have to actually know
JavaScript so I figured that the best thing to do is learn JS and then use an
abstraction (i.e. Coffescript) and tools like AngularJS and Node.js... Is my
approach wrong? :-/

~~~
tragic
You can get around it to some extend with source maps and so on - just make
sure you're generating them with whatever build process you use.

In practice, however, all that lovely Coffeescript syntax can easily trip you
up; often something will compile successfully, but not to the 'right'
Javascript. I wouldn't recommend CS until you get your head around the
fundamentals of JS. In particular, CS does some very 'clever' things with the
Javascript this object; I have certainly lost my scope at unexpected points in
CS programs (often in loops). When you're optimising code, furthermore, you
definitely need a strong sense of what JS code you'll get out the other end.

I'd recommend Reginald Braithwaite's _Javascript Allonge_ as an overview of JS
semantics - the material on scopes and environments is very useful, given that
JS behaviour on that score is ... idiosyncratic.
[https://leanpub.com/javascript-allonge/read](https://leanpub.com/javascript-
allonge/read)

------
alexandercrohde
I guess I don't really get the point here. This video walks a line between
comedy and fact where I'm not really satisfied in either.

I can't always tell what's a joke, does he actually believe people would write
software to compile to ASM instead of javascript because there are a few WTFs
on js's "hashmaps." Much likely a newer version will come out before 2035? Or
was that a joke?

I also feel like poking fun at "yavascript" at a python conference is cheap
and plays to an audience's basest desires.

Really I see a mixture of the following: \- Predictions about the future, some
of which are just cleary jokes (e.g. 5 year war) \- Insulting javascript
preferring clojure \- Talking about weird shit you could, but never would do
with ASM js \- Talking about a library that allegedly runs native code 4%
faster in some benchmarks, with a simplistic explanation about overhead from
ring0 to ring3 overhead.

------
pookiepookie
I'm not sure I understand the claims toward the end of the talk about there no
longer being binaries and debuggers and linkers, etc. with METAL.

I mean, instead of machine code "binaries", don't we now have asm blobs
instead? What happens when I need to debug some opaque asm blob that I don't
have the source to? Wouldn't I use something not so unlike gdb?

Or what happens when one asm blob wants to reuse code from another asm blob --
won't there have to be something fairly analogous to a linker to match them up
and put names from both into the VM's namespace?

------
camus2
nice nice,ultimatly languages dont die,unless they are closed source and used
for a single purpose ( AS3 ). In 2035,people will still be writing Javascript.
I wonder what the language will look like though. Will it get type hinting
like PHP? or type coercion? will it enforce strict encapsulation and message
passing like Ruby ? will I be able to create adhoc functions just by
implementing call/apply on an object? or subclass Array? Anyway , i guess
we'll still be writing a lot of ES5 in the 5 years to come.

~~~
testrun
AS3 is not dead, and it is now open source

~~~
camus2
source?

~~~
testrun
[http://flex.apache.org/](http://flex.apache.org/)

------
leichtgewicht
I like that he mentions "integer". It is still very incredible how JavaScript
can work well without a integer construct. Or threads and shared memory. Or
bells and whistles.

~~~
_random_
"JavaScript can work well" \- depends on what is understood by 'well'. Some
craftsmen are capable of building cars from junk.

------
base698
I wish some of those talks were available for purchase on their own and not in
the season packets. Definitely a few I'd buy since I liked this talk and the
demo on the site.

Guy has good vim skills for sure.

~~~
clebio
The pricing model used to be different -- $8/mo. He changed it when he stopped
producing the series. I agree the current pricing doesn't make sense. I feel
slighted for having subscribed for several months, but would now have to pay
_more_ for content that I used to have access to. Ach, schade. That said, the
material was compelling enough to buy at the time!

------
Kiro
A bit OT but what is the problem with omitting function arguments?

~~~
GeneralMayhem
Not necessarily anything as such, but it's the sort of thing that can easily
lead to bugs if you don't know what you're doing. It's the only way to
overload a function with multiple signatures, though, so most libraries and
frameworks make heavy use of it.

------
yoamro
I absolutely loved this.

------
ika
I always enjoy Gary's tasks

------
jokoon
I want a C interpreter

~~~
ahoge
[http://en.wikipedia.org/wiki/CINT](http://en.wikipedia.org/wiki/CINT)

~~~
jokoon
why not put that in browsers ?

~~~
Yorrrick
To make a complete platform, you also need APIs, so there's more to it than
just picking a language. You also need to figure out how to sandbox it; CINT
appears to give programmers access to unrestricted pointers. You also want to
get multiple browser vendors to agree, so some kind of specification is
desired; CINT targets its own unstandardized subset of C. And you ideally want
it to go fast, but CINT appears to be pretty slow:

[http://benchmarksgame.alioth.debian.org/u32/compare.php?lang...](http://benchmarksgame.alioth.debian.org/u32/compare.php?lang=cint)

So there'd be some work to do. You could also compile the code, but complete C
compilers are not fast, in browser terms.

------
slashnull
ha-zum yavascript

------
jr06
Video tl;dw:

Gary Bernhardt (rightly) says that JavaScript is shit (with some other
insights).

HN comments tl;dr:

50%: "Waahhh, JavaScript is awesome and Node.js is wonderful, shut up Gary
Bernhardt."

25%: Smug twats talking about how they're too busy changing the world with
JavaScript to even bother to comment.

25%: Pedants and know-it-alls having sub-debates within sub-debates.

Pretty standard turnout. See you tomorrow.

~~~
pekk
Thanks for the summary, but I didn't exactly see that he was saying JavaScript
is shit so much as that it was imperfect (10 days, etc.) but that didn't even
matter.

------
angersock
It's been kind of fun watching JS developers reinventing good chunks of
computer science and operating systems research while developing node.

This talk has convinced me that their next step will be attempting to reinvent
computer engineering itself.

It's a pretty cool time to be alive.

------
Fasebook
"I get back to the DOM"

------
h1karu
somebody tell this to the node.js crowd

~~~
_random_
Can so many lemmings be wrong?

------
inglor
This is actually not a bad lecture. Very interesting, a nice idea and
surprising.

------
adamman
"It's not pro- or anti-JavaScript;"

OK

~~~
nkozyra
Did you watch it?

