Brendan Eich: JavaScript, Firefox, Mozilla, and Brave | Lex Fridman Podcast #160
krB0enBeSiE • 2021-02-12
Transcript preview
Open
Kind: captions Language: en the following is a conversation with brendan ike creator of the javascript programming language co-founder of mozilla which created the firefox browser and now co-founder and ceo of brave software which has created the brave browser each of these are revolutionary technologies javascript is one of the most widely used and impactful programming languages in the world firefox pioneered many browser ideas that we love today or even take for granted today and brave is looking to revolutionize not only the browser but content creation online and the nature of the internet to make it fundamentally about respecting people's control over their data quick mention of our sponsors the jordan harbinger show some basket meal delivery service better help online therapy and eight sleep self cooling mattress click the sponsor links to get a discount and to support this podcast as a side note let me say that there's a tension between theory and engineering that i've been thinking a lot about i tweeted something like good execution is more important than a good idea but one helps the other i think the wording of that sucks but what i mean is a a good idea is a must but in my experience good ideas are in abundance good execution on the other hand is rare i think some mix of good timing good idea and good execution is essential getting that mix right is tough and brendan somehow multiple times in his career did just that i'm starting to believe it's more art than science like most interesting things in life if you enjoy this thing subscribe on youtube review an apple podcast follow on spotify support her on patreon or connect with me on twitter at lex friedman and now here's my conversation with brandon ike when did you first fall in love with programming i didn't program a lot when i was in high school but i had a friend who had a commodore pet and after we saw star wars he said hey let's make a basic uh program that does the death star trench run and it was just you know simple 2d graphics and i didn't know what i was doing so i just helped him out uh on the math and stuff like that i was a math and science kid i was really into uh the hp calculators of the early mid 70s these were the rpn they were really strongly built and as alright goldfinger instead of gold divinely heavy there's probably some gold in them too gold metallization but they were awesome calculators and they had all the scientific functions so i was really into that um so i aimed towards physics um i was a little late for the i think the you know the 20th century golden age and i read a lot of science fiction so i was like yeah it's onto hyperdrives and warp drives and physics was not going to get there quickly and i started hacking on computers while i was studying physics as an undergraduate at santa clara university and you know i dodged the fortran bullet because i was in the science department instead of the engineering department where they still did fortran card decks i think they had an auto collator but we were using pascal and uh i got one of the first portable c compilers uh ports to the deck mini computers were using and i i fell in love with programming just based on um you know procedural abstraction uh pascal just what now would be considered old school like structured programming from the 70s um nikolas vert the creator of pascal was a good writer and a good pedagogue right he always at eth would do these courses where it's like build your own computer build your own compiler build your own operating system from scratch yeah kind of and uh i know some people who are grad students under the study was um he would torture the students with things like this custom email system that had 25 word limit [Laughter] and uh things like that i unfortunately dodged both the pascal and the fortran bullets uh could you uh maybe uh linger on the pascal like what kind of programming language was it what is it reminiscent of of today because it sounds like it may have had uh an impact on your own trajectory yeah it was in the algol family and algol was um you know the big uh successful uh language design and compiler project in the 60s it had a successor called algol 68 which is ambitious but not as successful but pascal was kind of wordy procedures and functions language it distinguished between functions which return of value and procedures which don't which just compute and you could say that whole algol family went into ada pascal had a second life thanks to borland with turbo pascal which was hugely successful uh i think in large part due to anders helzberg who then went to microsoft and did you know c sharp and done that with his team there has done really well doing typescript type javascript so yeah there's there's a lineage here uh but i was also interested in c in unix by the time i was an undergrad because uh people were bringing unix up on all sorts of hardware i had some friends who were doing their own wire wrapped computers 68 20 maybe and i was wire wrapping for my engineering course um 1609 or something simpler building a computer on a board and i wanted to build a more ambitious one and port unix to it but i picked the wrong processor i picked the national semiconductor ns16032 which was this amazing you know cisc complex instructions that computer and not the reduced instructions that computers that were just being contemplated into the mid-80s um and risk ultimately went out risk one in some ways it it dissolved into that you have both now you have these super scalar architectures where like intel has kept probably too much backward compatibility at the instruction level but that's just a there's a front end that parses that into these you know these wide internal instructions so you know the very long instruction word research that um was also interesting at the time kind of became the micro architecture inside the backward compatible intel but i picked a national semi chip and it never got made successfully it was full of bugs and i never could have brought it up but i went on uh out of physics after three years into math computer science and like i said i did it because i saw um i was being sort of childlike and naive about physics and i thought meanwhile the valley is go go for computers the apple ii right the the pc the intel um 8086 uh 8088 based pc the ibm you know gave microsoft the future for in a somewhat fishy deal so it's wide open in the computing space but in physics you you were as optimistic about physics no i mean i was one of three brothers who were all in the same grade i have a twin and a younger brother who um skipped second grade was with us the whole time after that and you know he went on he actually studied under kip thorne at caltech wow but he also didn't he ended up in software physics does it make you sad that uh theoretical physics even with strength theory hasn't really had any foundational breakthroughs in the latter part of the 20th century and uh yeah in fact i'd say the problem is theory over over experiment i would say you know we need more aristotle unless plato you know mathematics it's not all physical there are lots of mathematics that cannot be realized as far as i know in this world so to understand the world you need to do experiments you need to not just dream up uh inductive theories that could have lots of alternative theories competing with them with no way to decide between them except aesthetics which is not a good guide in my opinion i don't know if you uh are friends with have a relationship with elon musk where's the in terms of like what you would love to see our society investing in building up is it closer to elon or is it closer to feynman and einstein and those well those gentlemen are no longer with us and i think that's noticed so like i said the real glory days of physics the famous pictures from germany before the second war were uh just a fantastic assembly of brains um you know schrodinger and einstein and physics i think took a wrong turn that maybe all of um i would say western science took in going for models over reality right you see this in all sorts of fields now we can build models that are very predictive and generative and then we build actual devices or you know semiconductors things like that that's that's good i'm not dismissing that uh we need good models we need to experiment and prove them and and test them but the problem i've seen in physics which you see certainly in economics the dismal science and you see surprisingly in other so-called hard sciences is models that don't really have to be tested against reality they can instead become policy tools or they can become like i said uh one of a large family of alternate theories that could be as predictive but nobody's doing the winnowing out that's such an interesting tension in society you see this in even the software sciences which have a deep love for like psychology you see this in epidemiology not with the virus absolutely it's this tension of you know how much of the world can we understand through just a beautifully fit model and then at the same time my main work is in machine learning where it's like there is no provable thing usually it's just it's kind of you it's all about just getting the right data set and getting tricks and so on and if there's this tension even in my own soul of like i grew up i grew up on theoretical computer science like i loved approximation algorithms like all of that like different complexity classes just those little puzzles i mean i don't know do you to you as somebody who was in math and computer science and then ended up going into places where you engineered some of the most impactful things in this world do you see the p versus np all that whole space is interesting at all yeah uh it's it's not that useful in practice right people are using it uh with sort of crypto analysis or asymptotic arguments about you know can can we have a quantum resistant crypto algorithm things like that which may not be practical right if you if you follow mikhail diakanov or gil collide there are big questions about how health quantum computing will scale up um how practical it will be is that something that you think about quantum computing and not except for spare time like you said i'm not using this kind of computer science in practice because almost everything now is engineering and finding ways to get um computers to be more useful for people which goes from you know design problems which are really kind of an art like you've said anything you can't automate as an art yeah well we can have you know machine learning compose music and it can imitate you can train it it can sound kind of decent but maybe lacking that genus aqua but you know user interface still i think requires uh human art so speaking of things that didn't follow a perfect theory and model uh javascript so there's two things one had an impact on the world a huge scale obviously and it also still is one of probably the most popular programming language in the world so can we go back to the origin story uh can you tell the story of how javascript was created yeah i was at talking graphics after graduate school for seven years and it got to be big and successful and divisionalized and political and i thought um kind of boring and a friend who'd been there went to one of the last of the super companies the super startups in in the early 90s there were several i suppose general magic was a little after that around the same time but micro unity was that company that i went to and it was because my friend uh jeff weinstein had gone there from silicon graphics he recruited me and michael unity was doing everything so this was like the ultimate sort of pretend grad school it was doing a new fab new semiconductor process it was doing new um analog and digital circuits on the same very large but not wafer scale chip originally it was um five centimeters on the side it was really hot too so i needed a water cooler it was a cray killer and then they shrunk it and they tried to do a home sort of media processor that was essentially a barrel processor but you could think of um trying to do all the things that we now see in modern architectures uh with short vector instructions and um sort of wide instructions or multiple issue uh and and doing a lot of the stuff in software because the second iteration the set-top box was really for avoiding the cost to the cable company of rolling the trucks out to replace your garbage general atlantic set-top box with a slightly newer less less uh garbagey one so if you could have software upgradable um set-top boxes the cable companies uh thought they could save a lot of money and add features is this assembly or was it it was which level of design it was like we were writing in um we were using gcc we're writing c plus plus and c uh somebody i i worked with there um really very smart guy hired from a sort of wall street um hotshot programming consultancy did his own hardware design as well as software and we were working on how to make uh not only short vector units but general bit shufflers and permuters so you could do things like um you know crypto algorithms efficiently and you could do uh demodulation of the cable you know complex uh quadrature amplitude modulated signal so you're basically taking a to d converters dumping things in buffers and then doing the rest in software all the framing and the reed solomon and viterbi and all that error correction so that was really great learning experience but it was not going to work it was doing too many risky things at once right if you as jim clark said to me when i hopped to netscape after three years at micro unit he said oh yeah you do 10 things each one in 10 odds it's going to be 1 in 10 billion the multiplication principle so you know netscape was already a rocket and i passed the chance to go there in 1994. i knew the founders because i worked at sgi clark's company could you pause for a second and escape when was the launch of this rocket what uh 94 94 was the launch of the escape and i went there in early 95 in april okay but uh so you said you missed the launch well i missed the the end the first floor employment opportunity but the ipo was was august 1995. so i was there for that how obvious was it the netscape was like world changing uh what was the layout was netsk one of the first big browsers yes so when i was at micro unity still in 93 we saw a browser called mosaic and up till then we'd used email and we'd used usenet the nntv protocol we'd use news readers we used ftp we used all these old internet protocols all relying on the dns and tcpip and udp for that matter when i was at silicon graphics we brought up the whole stack right we had to you know discover how how to find the ethernet addresses on your network and then find ip addresses for them our protocol all that stuff and it was great because nobody knew in the 80s what was going to win all the proprietary stacks like ibm sna and decnet and all these other protocols were saying it's we're going to do it or it's going to be heterogeneous future and instead it was you know berkeley unix and the tcpip stack that dated back to the arpanet that won and i think we knew it we all knew it at sga but the sales people didn't and so they kept trying to get multiple network stacks interoperating but in the end uh it won and so it that was the internet and it was email and texty and it was used very texty and then tim berners-lee did his thing but i don't think i was paying attention and i think the date when he first did it or when he wrote the famous email has been pushed back to but i noticed mosaic in 93 because one of the things that mark andreasen and eric biena did at ncsa was they innovated on on the html early html standard they in particular mark sent this email saying hey everybody we think you should be able to put an image in a page and you know when he sent that eric bean had already written the code and you know i talked to tim berners-lee more recently just a few years ago and he was like oh we had another way of doing it yeah didn't work out because mark shipped his in mosaic and this convinced me of several things one the internet meant there was a huge first mover advantage and being fast getting on first mattered a lot and so you know richard gabriel of scheme and poetry fame has written about this what's poetry uh well he's a poet uh actual poetry he's like he talked about some kind of song no no i mean he's the founder of lucid which is where jamie zawinski worked before netscape and lucid was doing you know compilers and lucid emacs which was a fork of emacs famously jamie fighting against richard stallman stall max and so richard gabriel you know very very brainy computer guy but also a poet but he wrote a nice essay that gets abused all the time in fact jamie's put a kind of warning in front of his version of it on his site jwc.org called worse is better and this is about survival advantage of software in the network world in my opinion it's about unix it started out being framed as unix and lisp good news bad news because all the list people the mit people were like oh you know this is the crown jewel right uh scheme this is faberge egg or common list this giant cathedral of course we're going to win this is civilization and those you know those farmers in new jersey to borrow from the sopranos those those kicks down to bell labs they're just you know there's nothing sound there it's all hacking yeah um well guess what one wow so you're saying this is a fundamental like principle of the internet is moving fast wins you could say in in almost any network system like in biological evolution you see successful alleles sweet populations and they don't always have um you know they are free of flaws the heterozygous advantage right you can get both parents give you the gene variant and you get sickle cell anemia right but but if one of them does you're more resistant to malaria and so this isn't um a beautiful process except at large scale and then you realize that because it moves fast and can adapt it it can win and people still struggle with this i i used to struggle with this because javascript was done in such a hurry and the force of web compatibility meant early mistakes couldn't be fixed and even the standards process injected new mistakes as it will but often standards bodies go back and making compatible changes you can't do that with the web it's more like again like biology you you preserve what still works you don't want to break atp metabolism or whatever so um you have to kind of resign yourself to the reality of um worse is better being enshrined in actual design points you might not like and that happened with javascript and i'm way over it but it also i think was a huge advantage why javascript has kind of swept a lot of programming domains um people will say oh it's not because of merit well you're right but we also improved it over time in the standards body i spent 20 years doing that and you don't get that choice it's like i'm not saying that that was the best language i'm just saying that was the right time to do it and i like to say the alternative was not to do it i could have told netscape i can't do this it's too rushed and it would have been visual basic script it would have been bad uh so that's a good way to present the alternative but so you're it was a netscape and you were you have written in how many days and why was it only that many days and what was the the goal and the underlying principles in your mind so the whole i'm sort of describing worse is better in a frenetic way because it fit the the model of netscape when when um it was known that jim clark and mark andreas were founding netscape and they did the first release in 1994. that browser took over from mosaic in fact that's why mozilla is called that it's the mosaic killer it's like the giant monster that kills mosaic that's awesome and they knew they could you know it wasn't that again it's not like you're doing advanced scientific research that is changing the world you're more like taking down uh the last iteration in the browser mark did which had images and you know other importances before you stopped working on it and you're making netscape the new thing that has images plugins which was the way to do video back in the day it had something that's kind of died now for tiled windows called frames and frame sets html tables that was new eric bina did tables in escape 101 so when i got there they were heading toward ipo clark wanted the ipo early i think his instinct was right and that kicked off the whole dot-com era right there was a recession in the us in 91 you can see old law and order reruns where they talk about the recession how hard it's hitting new yorkers and after that greenspan really goose things at the federal reserve and and technology had been sort of fermenting in a way that came together with the internet and netscape made it you know possible to do pets.com to do ebay to get people to recognize a url on a billboard and then type it in when they get home and that was huge um that that was so fast moving a rocket that uh mark and um the engineering team there thought we we need to make this a programmable browser not just a a document viewer not just a video it's all html with images and tables and also like you said frames really plug-ins there's no dynamic element at all yeah the most dynamism you get was from a plug-in which there were a few of them then flash didn't exist at that point uh it was i think um java applets yet or no well that's the thing we did the deal with sun in fact i was recruited to go do scheme in the browser remember guys stealing gerald sussman's beautiful lisp variant i was going to do it in the browser because my friends from sgi thought hey we like scheme you like scheme and i'm like i hardly ever use scheme it's not really used in industry except in sort of silos but i like it okay i'll come do scheme in the browser i have a slide from my 2017 uh talk where i have bruce wallace crawling through the duct and die hard he's like come out to the coast have a lot of fun come on do scheme in the browser um but when i got there there was no scheme in the browser because they'd started a deal with sun microsystems and my best contact there was bill joy who i admired as a berkeley unix founder and son founder uh and bill got the idea of making the browser programmable too and so the idea main idea was to put the java vm which at that point was not really easy to embed into netscape including the netscape version on windows that was still most popular which was the 16-bit windows 3-1 which was going away microsoft was coming out with windows 95 and everyone was afraid they were going to do you know internet explorer i guess two at that point three the next year they already bought uh or invested in somehow spy glass this other company that shot out from ncsa at the university of illinois and in fact microsoft had tried to buy netscape in late 94 before i got there and i heard about this later i heard they offered way too little money and so you know jim barksdale and jim clark said get out of here pound sand but then they realized oh this is going to hurt us because now they're going to copy us didn't happen right away i'm not sure when gates internet title wave memo was written that's the famous memo he wrote when bill gates realized that microsoft was going down this old copy aol path or copy compuserve path a project called blackbird presumably after the sr-71 i don't know but they were going to make a you know dial-up service with a custom content language stack and custom rendering it wasn't the web um you know they could have content partners uh they have a lot of money but it still wasn't to scale the web it wasn't going to be compelling and gates realized this and he turned the company on a dime and they couldn't buy that escape again i'm not sure the timing so they decided to copy it and once we realized that everybody inside that escape felt even more urgency and more of a frenetic mood and so my chance to do scheme disappeared when the java deal started brewing but there was still a chance to do a companion language to java because java was a compiled is a compiled language it's evolved and improved quite a lot since then too but it was for sort of serious advanced programmers that cost a certain salary or hourly rate and people observed bill bill joy observed and i mark and jason and i observed that in a mature stack like microsoft you really benefit from having a scripting language like visual basic which became visual basic script in ie3 but didn't take on didn't take over uh kill javascript that you need two languages one is for the component writers who are higher priced and more expert and the other is for uh scripters certified public accountants uh designers graphic designers with some programming inclination anybody amateurs doesn't matter there's a much more demotic approach there for programming the components together gluing them together some people say duct tape language which i don't really like but we saw that bill joy and mark and jason and i we saw the need for companion language and the gleaming r i was to call it javascript i didn't like it that was marketing's plan mark called it moca which i liked and netscape marketing i think didn't like that so they said oh there's some trademark and some software somewhere that uses mocha so we can't use that and they tried live script in august and that didn't last and then finally we got the trademark license in december 1995. but the work i did to prove that it could be done was important because i i came in in april and even then netscape was growing so fast that they couldn't find an open hiring requisition in the client team for me so they hired me into the server team and i worked for a month on server team on what became http one one so i was actually i had done protocol work at silicon graphics with greg chesson uh former bell labs intern grad student intern who knew all the unix founders and greg was very interested in taking um protocols to the next level with vlsi because he thought that cpus wouldn't wouldn't scale up he was mistaken in that unfortunately moore's law more than kept up and you have you know gigabit ethernet running with conventional processors but i worked on protocols at sgi as well as unix kernel hacking and nfs and things like that so i i came into netscape to work on the server side for a month but i was i was thinking the whole time what should this language be like should it be easy to use might it syntax even be more like natural language like um hyper talk which is bill atkinson's language in hypercard if you have ever used hypercard on early mac uh and i thought uh well i'd like to do that but my management is saying make it look like java which looks like c from a distance what does that mean is it braces we're talking about visually yeah i mean like what management do they understand what they don't marketing didn't know but but management did like rickshaw vp of engineering knew and we had a plan even that was if you have this companion language you're going to glue things together between java and javascript so you're going to have commerce in memory in the heap with data types so you're going to want some of the data types in java to reflect into javascript you're going to want the primitive types that java unfortunately separated from objects so at least some of them number double let's call it in java's terms from the c term for double precision floating point um or strings or booleans um and objects and so right away there was this constraint looking like java meant kind of the c curly brace syntax but also some of the data types and objects like objects and so on all that kind of stuff comparison operator garbage collection yeah uh even the bitwise operators and the shift operators including the unsigned right shift which java had because it didn't have unsigned integer types it's it said if you want to do unsigned operations use an operator and that turned out to be important much later i'll tell that story five time but javascript inherited a set of operators the expression grammar the statement grammar up to a point from java but i wanted a functional language i wanted scheme a little bit of scheme even though it wasn't as clean as scheme i wanted you to love sergeants and drops you had a love for scheme and lisp but that that that functional language yes i wanted first class functions because i i saw the need for callbacks in the browser where it's a single threaded program all the early browsers were single threaded and it's the right model for users most users weren't ready for mutual exclusion and threading so in a single threaded world you cannot block the user interface so you have to use a callback and run later and the without getting too fancy and trying to capture the continuation like call cc does in scheme i thought i'll just make it easy to have fun arcs first class functions you pass you know downward and they can call back and be called back and java didn't have that at the time it had it took forever to get proper first-class functions uh lambda is now into into java java seven or eight i think it did have concurrency right from the from the very beginning but you were thinking that the javascript in the browser would not have the luxury of being concurrent that's right and the reason was java was going to run into plug-ins so it could fork threads and go go to town but the main action in the browser was in the single threaded program the single unix process on on unix or windows and it was where you had to service the event loop and then go you know do things respond to the network lay out some html render it turn you know widths into heights by filling containers boxes uh the early what became the css box model uh and run scripts to you know make the thing livelier respond to user input uh and all that event driven programming was in part like hypercard because hypercard had this on event name syntax and so that's why you have in javascript on click run together as the name of the event handler and there's some funny ones on mouse over and on mouse out people still complain about those but you know um there are many more events now over the years standardized but it was a mix of event-driven single-threaded programming because it had to run in the main thread of the browser where the action is and java never got there which meant java could not interact easily or quickly or in a nested way with the document with the objects reflected from the html document with the tables and forms and so on and that that is one of the reasons i think javascript survived and java kind of died java was in this plug-in prison it essentially was confined to a rectangle the apple rectangle and while we even built next year nick thompson a friend from sgi who was an intern grad student at cmu at the time built the first version of live connect to glue java and javascript together to deliver on that vision where you do have commerce between the data types and the heap um did it work it worked but you were java was in charge javascript was in charge and java was just these components these helpers you might as well do everything in javascript and what happened over time it's like an evolutionary filter it just kind of who needs the plugin and in fact sun mismanaged java as a plug-in they they thought well netscape is giving us the distribution vehicle and we don't care about the browser it's just about getting java out there and that was a big miscalculation they then tried because microsoft was killing netscape after years they tried getting into microsoft and you may remember there was a sun microsoft deal which famously blew up and and microsoft kicked java out of windows and that's when they really pulled the trigger i think they already evaluated it and liked it on anders helsbergs.net and you know c sharp and decided we're going to just not have java we don't want you know any of that sun stuff we don't want the patent risk we don't want i'm not sure what the fights were about there was some patent angle to it i think and up till then microsoft had been using java components like in outlook web access which had a lot of javascript to be a web mail like hotmail like user interface they had to call the the mail server drew htp and they they used a a java object to do this and when they gave the boot to sun they suddenly other you know the left hand gave the boot and the right hand said we better do something else in outlook web access what are we going to do and they said let's just add an activex component which is their own native way of embedding things in languages and we'll make it it'll be what became xml http request which is now a web standard for calling asynchronously and it's been replaced by the fetch api in html5 or html living document but this whole lineage goes back to java being successfully the loser and getting kicked out and after microsoft kicked it out it was a plug-in and you would find it required for like smart card banking in in the nordic countries where that was mandated by law but really didn't get used much or you know there were pilots who used it for um flight information but flash which netscape could have bought but unfortunately didn't they really definitely did yeah we would have screwed it up i mean what year are we talking about with flash i think after the ipo so it was probably late 95 and flash was wrong was it adobe no it wasn't no it was it was called future splash and it was these brothers jonathan gay i think his name was he he uh came knocking and the marketing guy at netscape who was screening the technology partners or want to be acquisitions was brutal and just everybody wanted to get on the netscape you know stock gravy train and he sent them packing and they they ended up selling the macro media and macromedia was where flash was created and the good thing about macro media was it was a um tool company so it invested in you know the best ideas i think which are still somewhat lost to us of flash the timeline uh animation is sort of an immutable function over time they had the tooling around that too like that dreamweaver there's a flash flash a director there were a bunch of them yeah i mean yeah they that was a flash builder was one of the last ones these tools were used by real artists and you know special effects people and designers all the restaurant websites around 2005 were done in flash which was you know we were trying to do html5 at the same time that was the firefox era we were trying to make the web capable enough you didn't need flash but if you recall you go to a restaurant it's like this is kind of like a game or something it's like a flash all the font looks small you didn't like flash from the beginning you're like this is this doesn't feel right not really i actually admire flash's technology and i'm pretty pragmatic about these things and i i realized that you know it doesn't matter if you're dealt a bad hand like javascript was a rush job or if you have flash as a plug-in and you can invest in the tools and make it pretty good uh you should you should make it better for your users and grow it as best you can and what happened with the browser due to microsoft's monopoly abuse for which they were convicted and you know um even after that until i think firefox and then chrome was people kept saying oh the web can't do x i can't do y we'll have to have a plug-in we'll have to have a new approach we'll we'll clean the slate and have a new web and everyone who said that failed and the reason they failed is because there's too much value in the web this huge network and the worst is better principle means that you can not only start bad which they all sneer at but get on first and get wide distribution get sort of evolutionary advantage in the priority of place but you can also improve it over time yes and so if you're going to improve flash and for some reason flash is now out of favor steve jobs said you can't have flash on the iphone that was probably the death knell put your energy into javascript and that happened right so we we did things at mozilla with adobe to improve which bought my macro media to improve flash and to improve the version of javascript that was in flash we tried to standardize that oh that's right i'm getting ahead of myself yes yeah that's it that's right can we just rewind yeah it's a magical like you know it's a special moment in the history of all of computing it's uh we'll talk about it later but it's arguable it's possible that the entirety of the world will run in javascript at some point so like it's like those are those days it would be it would be interesting if you could just describe actually zooming in on the how the cake was baked uh from the you know the the several days that you were working on it what was in your mind uh how much coffee were you drinking were you nervous why you're freaking out i'll try to remember it i mean you're right there are these pregnant moments you see in hindsight maybe they're overrated but like hegel sees napoleon on horseback right yana and says there's the world spirit uh on on horse and uh i knew that there was a chance to do it mark knew and he was my you know executive sponsor and he was the one you know sort of brainstorming how the javascript should be right there in the page that was important for him to say that because i i thought so too but a lot of people were like well you can't write programming language in the middle of the markup and indeed there are problems if you did it naively you'd see the code laid out as like random gibberish so i had to figure out how to hide that that was a challenge is that is it a breakthrough idea i mean so you mark thinking about this idea that you just inject code in the middle of the market the web page yeah it was considered kind of heretical there was an sgml guru i forget his name but he corresponded with me and at first he was angry he's like you should have used a marked section why didn't you use a marked section and i said well html marked sections are not part of html by the way and they're not supported in the browser and so i did some hack that was equivalent and over time you could do the proper sgml thing but it eventually came around and it was again sort of of evolutionary necessity it was almost like introgression like like you know the idea um which liam arguelles i think helped get across that uh we have to consider mutualism biology that maybe you know mitochondria were ancient uh prokaryotes that got into the cell and became beneficial um somehow uh the same sort of thinking applies uh you have to embed javascript in html it's gonna be a good virus it won't so the code the code becomes data in the sense it just gets carried it's very carried along but is there is there's the side of the so you were focusing on the netscape at that time doesn't the browser have to support interpret correctly this mix of html yeah and whatever code i had to hide it from old browsers including netscape one one which was predominant then so i used an html comment but the inside the container that comment lived in the script tag which is a new element i could make different semantics in netscape 2 where those html comment delimiters instead of being multi-line brackets became one line or essentially one line so you wrote the javascript was written the programming language was written as a comment a comment for all browsers and a set of uh brackets that were ignored with real code for new and it was this two-way comment hiding hack as i called it that was absolutely necessary for us to get off the ground we couldn't have bootstrapped javascript without it we didn't have scripts that were loaded from a separate file the only scripts in netscape 2 were inline in the document what were the challenges here what what like what uh you know typing uh uh what were the choices you were thinking about garbage classified because garbage color i didn't have time to write a garbage collector so i just i didn't at first so the thing was using essentially arenas or what gnu calls obj pools and just would run out of memory eventually and i added reference counting in a hurry after the 10 days in which i hacked so after i was in the server team doing http 101 and thinking about the language i finally got transferred to the client team in early may and that's when i you know i got the go sign from mark and it was like we can't wait because people inside netscape are doubting even people inside sun are definitely doubting bill joy was the champion but he was like alone in that in seeing there was a role for javascript as the as i call it the sidekick language robin the boy hostage frank miller put it in the dark knight returns um that uh there was a silly little language that would be the glue language it could become important over time and you were better off having that complementarity that pairing of languages just like microsoft stacked it with visual c plus and visual basic so what was the big moment of uh i'm done so i had to do a demo i i forget the dates i think i for a history of programming languages paper that alan where's brock did with my health he did a lot of the writing um i think it was the 10 days from like thursday evening through to the following weeks you know whole that week and then into the monday sleep not not enough and i was really uh going fast because i had already used a lot of um c compiler and front-end compiler knowledge that i'd gained from undergraduate school when i started getting into computing as a renegade physics major uh people were formalizing more efficient bottom-up grammars parsers for bottom languages uh really lalr 1 was the big thing and i studied all this and learned how to parse them and in the end uh if you're doing c languages you often do what um what what dennis richie did anyway which is a recursive descent parser you can hand code it and i did that for javascript in a blazing hurry mostly got it right i didn't you know have precedence in version problems or other bugs but i copied a lot from java and c and i tried to keep things simple like the equality operator in those 10 days sprint between two objects of different dynamic type said no they're not equal their types are different and then after that i had internal early adopters and they were using javascript to like match a number against a database field that had been string eyes and they said oh can we just have implicit conversion and like an idiot i agreed i gave them what they wanted i was trying to please them and get adoption and that you know broke what what equivalence relation um nature there was to the double equal you know there are some four edge cases with not a number that break that of two but it really broke it um having implicit conversions in the operator is something that people still roast me over so let's let's talk about two things one it sounds like the comparison operator the equality operator is the thing that you regret so maybe making it sloppy making it sloppy so what is the biggest thing you regret in those 10 days and what is the biggest thing you're proud of so that that making it sloppy came after the 10 days and my lesson there which i've tweeted is when people come to you saying can you please make it sloppier add this cute feature the answer should be no and i should have known that because i think nicolas vere one of my heroes said the essence of design is leaving things out um but during the 10 days i also like i said i was in such a hurry i left out garbage collection came back to haunt me but i got reference counting in in time that people weren't running out of memory right away on on long-lived jobs what happens when you don't have garbage collection you have objects well you just run out of memory and you know i love it at first you write a short script and the page doesn't last long longer it doesn't do a lot and it's okay oh i see yeah yeah but if you're writing a game or something and you're doing event based allocation you run out of memory and this was noticed in the summer of 1995 and people were like what's going on oh yeah i gotta get i better go back and do reference counting and then the problem with reference counting is you're writing the language in the runtime in c an unsafe language and if you're reference counting and you overflow the counter you mismanage it so it goes high it gets stuck high you leak memory again and you run out if you underflow it you pre-memory that's still in use and even then we knew what all the security hackers came to know that you therefore have a potentially a remote code execution vulnerability because this was before things like non-executable heap memory and stack defenses against taking over memory so if you can from the the remote side write some html and javascript that just happens to exploit a bug in memory safety like it causes javascript to underflow a reference counter and the script still has its hands on that object and it's trying to call a method on it and there's some kind of lookup function table in the object but you've managed to stuff the heap with strings that forge their own lookalike for the function table you can call some other code and this was a problem right away so security you know javascript upped the ante java had this problem too but in its own vm and it just was you know a separate headache for sun to worry about we had this problem in netscape right away so netscape 2 came out after my 10 days and after these you know follow-on work to embed javascript better in the browser and to add garbage or collection through reference counting really i'd call it reference counting and get it shipped we had a bunch of dot releases where we fixed security bugs like maniacs but what is the thing you're you know when you sit back on a porch and just look out into the sunset what are you most proud of from those 10 days i think the first class function shines i think especially since java didn't have it and it was somewhat unusual ski made it in somehow uh at the end of the day in spirit i mean people complain because scheme has you know minimalism it has you know six or seven special forms it has hygienic macros it has call cc it has sort of a beautiful uh complete um set of forms to make the land of calculus pleasant to use in in practice um and javascript is you know kind of a multi-paradigm or shambolic just a small tangent you mentioned mark andreessen it sounds like in bill joy but staying on mark it sounds like he had an impact on you in that he sort of believed in what you were doing there can you can you talk about like what role mark had in your life yeah we would meet at the um the peninsula creamery in downtown palo alto and mark was just fresh out of you know grad school or whatever he was doing and he was a big dude and he got fitter later uh he had hair he he would order giant milkshakes and burgers and we would meet there and brainstorm about what to do and it was very direct because we didn't have much time the the sort of we didn't talk about it but the implication was microsoft's coming after us mark was saying things boldly a pre-ipo like netscape plus java kills windows right this is ambitious makeup browser programmable it becomes the new runtime for programs it's the meta os or it's the replacement os um but he still saw value in javascript yes even though he was saying that and java was the big name hence the trademark license uh he saw javascript is important and he even thought what if we got i told this another interview second state he thought what if we had my friend kip hickman who'd been at netscape from the beginning and who was a kernel hacker at sgi when i joined he started writing his own jvm before we consummated the sun deal and got our hands on their code and the java compiler java c which arthur van hoff had written very nice code was all written in java it was self-hosted or so called bootstrap and so we could use that as soon as kip's java vm could run the byte code from the the sun jvm running the self-hosted compiler to emit the bike so once we could bootstrap in the kip's vm we wouldn't need sun and mark was like well maybe we can just you know ditch sun or java vm or if you're a javascript vm we now we need graphics so mark was thinking far ahead because he knew you could do things with html and images but at some point you really want like cinema graphics or yeah three-dimensional like even sgi had already started its downfall because the first four vlsi team there had gone off to do 3dfx and all these other companies that made the graphics card on your pc right doom was was big and quake and so you were we were all playing quake i was old so i was terrible um but why not put that graphics capability on the web and in fact it finally happened uh at mozilla with firefox era with vlad vukichevic taking opengles and reflecting it as webgl but opengles is the mobile version of opengl which is a standard based on sgi gl so this whole lineage of graphics libraries or really graphics languages for what became the gpu and mark was thinking ahead it's like we need graphics too and i thought okay i could try to get somebody i knew at sgi but he's a grad student at mit he was studying under barbara liskoff he laughed when he heard about this later andrew myers he's at cornell a long time i think he's a full professor and mark said great we'll get him i'm not sure he's going to come we'll throw mon
Resume
Categories