James Gosling Built Java to Make Pointer Bugs Impossible. Chrome Still Has Them.

In a 2020 conversation with Lex Fridman, Java’s designer traces a line from a neglected PDP-8 to Emacs, the JVM, and a thirty-year war on memory errors.

JGJames GoslingInvité
Chaîne
Lex Fridman Podcast
Publié
24 sept. 2020
Vidéo
1:51:01
Lecture
17 min
Original
anglais
Ouvrir sur YouTube
En faisant défiler, la vidéo se réduit en bas à droite et continue. Les sous-titres suivent votre langue de lecture.
Langue de lectureDisponible en 2 langues
Cet article n’est pas encore disponible en français ; il s’affiche dans l’original en anglais.
RÉSUMÉ

En 30 secondes

James Gosling tells Lex Fridman that Java was never a language revolution for its own sake. It was an attempt to make the industry’s most common security bugs inexpressible, after years of watching consumer-electronics firms reinvent networking badly and C programmers leak memory. Along the way he recounts a 300-volt tic-tac-toe machine, a month of nights that produced Emacs for Unix, and why he would rather live in Star Trek than Blade Runner.

  1. 1Gosling insists on a style many teammates found unhealthy: extremely dense code, almost no whitespace, a function that fits on one screen, because scrolling is a form of forgetting.
  2. 2He still knows the first machine by heart: 4K of RAM, 12-bit words, a clock of about a third of a megahertz — and a modern machine is ten thousand times faster.
  3. 3Teenage electronics meant dumpster-dived relays and a cobbled power supply, running the tic-tac-toe machine at 300 volts with every connection left uninsulated.
  4. 4His best one-liner for the old editor: using TECO is using Emacs with your eyes closed.
  5. 5He wrote Unix Emacs in C because C was the only language that actually worked on Unix, and within a month or two it could edit its own source.
  6. 6In 2020 a study of Chrome’s high-severity bugs found 60 or 70 percent were still “stupid pointer tricks” — thirty years after Java was started to make that class of bug unwriteable.
TEXTE INTÉGRAL

Lire le texte remanié, chapitre par chapitre

Transcription seule
01

The square root of two is the number that destroyed a religion

Lex Fridman opens with a rumor: that the square root of two is Gosling’s favorite irrational number. Gosling has no idea where that started. What he does remember is a teenage binge on *The Dictionary of Curious and Interesting Numbers*, a book he nearly memorized, and a habit of making check and credit-card totals add up to an interesting figure.

Pressed for a square-root-of-two story anyway, he offers a better one. The Pythagoreans believed every quantity could be written as a ratio of integers until a proof showed that √2 cannot. In that sense it is “the only number that has destroyed a religion.” Perfection, he says, turned out to have an imperfect definition.

Gödel’s incompleteness theorems ruined the dream again in the twentieth century. The lesson Gosling takes is not the usual “there are things you can never know.” People want true or false. Allow a third state — true, false, or maybe — and “life’s good.” The aside is a key to how he designs: he wants a third layer beyond binary, and he cannot stand vagueness about what a program actually does.

02

He sees a program as machinery, so it has to fit on one screen

What stuck from theoretical computer science, Gosling says, is the habit of looking at a piece of code and proving to himself that it works. That puts him at odds with almost every team he has joined over layout. Software engineers get cranky about newlines and braces. He goes the other way: a style that is very dense, with whitespace minimized, so he can see a whole function at once instead of scrolling and remembering.

Teams have staged what he calls interventions. People arrive early, sit down, and wait for him. Then they say, “James, about your coding style.” He is, by his own account, an odd person to be a programmer. He does not think well verbally, he is a slow reader, and he is what most people would call a visual thinker.

Asked what he sees when he thinks about a program, he answers: pictures. Code on a page transforms into something like a machine, this connected to that, gears meshing. He does not see the lexical structure of letters. That is why a function has to live in one place. Inputs, outputs, and what the thing is doing have to leap off the page together. Abstraction, in his case, is not a verbal act.

03

The first computer was a neglected PDP-8, and the first hardware ran at 300 volts

The first machine he learned on was a PDP-8 at the University of Calgary. He still has the specs: 4K of RAM, 12-bit words, a clock around a third of a megahertz. Today’s machines, he figures, are about ten thousand times faster. It was not a supercomputer. It was an early minicomputer, cheap enough that a university lab might buy one, hidden in a back corner of the computer center after a networking project stopped using it. He noticed it sitting there, started fooling around, and nobody minded.

The interface was a Model 33 teletype with paper tape; monitors had not arrived. It was the first computer built with integrated circuits, which then meant ten or twelve transistors on a piece of silicon, not billions. Lex asks whether he felt Moore’s Law in his fingertips. Gosling refuses the romance: it was just a toy. The important part was economic. Building physical things required wood, wire, and switches, and those cost money. Software let him construct arbitrarily complicated objects for free.

He was broke. Electronics projects came from dumpster diving. The great treasure was discarded relay racks from behind a phone-company switching center, which he used to build a tic-tac-toe machine. Relays want a specific voltage, and he did not have a proper supply, so he cobbled one from scrap televisions that was “wrong, but worked.” The relays ran at 300 volts, and none of the connections were sealed. Lex is surprised he survived. Gosling says there are many reasons — including the teenage-geek discovery that thermite is easy to make.

Before assembly, the language on that PDP-8 was FOCAL-5, a stripped-down Fortran. He wrote blackjack, solitaire, and the programs he liked most: plots of functions and data, hammered out on the teletype as character pictures. He never thought of a language itself as beautiful. It was about what you could do. Syntax arguments still bore him. By the time people would hire him, the work was mostly assembly and Fortran on machines such as the CDC 6400, an early supercomputer with less compute than his phone.

04

Lisp is great except for the parentheses; Simula is the one above it

Lex offers the usual consensus that Lisp is the greatest language ever. Gosling puts it on his list and refuses to rank it first. The thing not to love, he says, is so many parentheses. Buried in those parentheses is an interesting language structure, and he has always suspected a friendlier Lisp is hiding somewhere. He has never spent the time to find it.

Up the food chain from Lisp, for him, is Simula — a language almost nobody has used and a great many people were influenced by. It was not an early functional language. It was the first object-oriented programming language, the place where objects and languages came together, and the place where coroutines first showed up as a language feature. Simula 67 dates to 1967.

Coroutines are almost threads without true concurrency, so you can skip the locking nightmare. You also cannot really use multiple cores unless you fall into semaphores and locks. The payoff is a mental model: you write as if the program were multithreaded and approach a class of problems differently. That combination — objects plus a parallel-looking sequential style — sat in his ranking above the language everyone wanted him to crown.

05

Emacs was TECO with your eyes open, written in C because Unix had nothing else

Around 1985 or 1986, Gosling had been using Unix for a few years. Everyday editing was a tool he describes as an ancestor of vi, decent if your input device is a teletype, and more humane than TECO, the Text Editor and Corrector that dominated much of the MIT universe. TECO had a macro language so obscure that a program on a page looked like random characters — “way worse than LaTeX.” It was optimized for high-speed touch typing: almost every key was a command, and with shift and control a key might be two or three.

The original Emacs, whose name means editor macros, began as a pile of TECO macros at MIT. Later implementations had entirely different codebases and the same philosophy. What Emacs added was being able to see what you were editing in a form that matched the document. Gosling’s analogy is the one that sticks: one way to think of TECO is “use Emacs with your eyes closed,” maintaining a mental picture of the cursor sitting between two letters while you issue commands.

His first real Emacs was not in C. A summer job on a Pascal compiler for Multics put him in Bernard Greenberg’s Maclisp Emacs for three intense months; he essentially lived in it. Back at Carnegie Mellon, the campus had one of everything, and Unix had no Emacs. He wrote one in C because C was the only language that worked on Unix. Within a month or two it was good enough to edit itself. Then it took over the university and spilled onto the ARPANET, because Unix was taking over the research community and Emacs was the best editor out there.

For a brief period he had login IDs on every non-military host on the ARPANET. People mailed him asking for an install, and he would help. Those were the days, he says, when nobody cared about security.

06

ARPANET already was social media, and cable companies hated what came next

Could he have imagined today’s internet? Some of it, he says, is remarkably unchanged. At Carnegie Mellon, social life centered on the ARPANET. There were no cell phones. People sat at terminals and typed. Email and one-line messages — chat, in all but name — were how you arranged lunch and dates. From the early to mid-1980s he was already living on social media. When the consumer internet exploded, his reaction was: what’s the big deal? The scale is astonishing. The fundamentals hardly moved.

What did change was the fight with vested interests. Cable companies, broadcasters, and phone companies, “at the deepest fires of their being,” hated the internet because they could not control it. Most cable employees thought their job was getting shows to customers who paid for them. Climb the hierarchy and the view shifts. The real business had always been selling eyeballs to advertisers. Gosling had dust-ups with cable firms where that stratified picture was obvious: the floor served users; the top sold them.

In the early 1990s a group at Sun wrote a proposal whose point was that internet technology lets anyone become a publisher — home movies to parents, kids’ essays, a grocery store or restaurant sending information out. They thought it would be great. The cable companies’ reaction was no, because then they were out of business. They could not see a path to revenue that did not protect the old pyramid.

07

Kodak could see the lines crossing and still could not take the hit

The lesson for big companies, Gosling says, is what happens when you are making truckloads of money on a model that is about to die. Sun’s big customer Kodak is the story he knows from the inside. Kodak had a substantial digital-camera and digital-imaging group. They could plot the trend lines: film was better today, digital was improving steeply, and the crossing would collapse the film business. They absolutely knew that. Up to the wall they were still making truckloads of money, and the math never quite said to lead the charge.

Leaping a chasm means a trough — revenue down, a quarter or three of ugly numbers. Public-company physics is simple: the one thing a CEO must never do is take a big hit in a quarter. Tesla and Amazon, in their early days, could ignore the stock market for a while. They optimized for happy customers, which can be an enemy of the bottom line. Amazon operated in the red as an investment in the future. That only works when patient money sits behind a charismatic figure with a large block of stock who can “just make it so.”

Bezos had a vision and the ability to follow it. Lots of people have visions; the average one, Gosling says, is idiotic, and Silicon Valley’s crash-and-burn rate is high — often timing and luck, not only dumb ideas. Tesla’s Model X he calls a goofball move, and the falcon-wing doors a complete travesty from an engineering perspective. They are also a symbol of leadership: if you happen to do something stupid, “make it really stupid” and go all in.

08

Jobs was on the wrong side of the line, and “work smart, not hard” usually fails

Steve Jobs, Gosling says, was a similar character: strong vision, really smart, not smart about the technology so much as about the relationship between humans and objects. He was also a jerk. Fridman asks whether that is a feature or a bug. Jobs was hard on people, and you can spin it as needless cruelty or as making people reach his vision. The results tell a story: people often did the best work of their lives. Gosling interviewed with him several times, liked him personally, and could never work for him.

Jobs would yell and call people names. Gosling does not think you need to do that. There is pushing people to excel, and there is too far, and he thinks Jobs was on the wrong side of the line. What he loathes about contemporary Silicon Valley is the mythology that followed: high-flying successes run by complete jerks, and a cargo cult that says if you want to succeed you need to be one. That, he says, does not compute. He knows plenty of successful people who are not jerks. They tend not to be in the public eye, because jerks do things that get them in the press.

Fridman pushes back from the other side. He worries about a Silicon Valley resistance to working hard, and hears “work smart, not hard” as a brief for laziness. Finding the short program still takes a lot of dumb effort. Gosling agrees and goes further: smart and hard is an “and,” not an either-or. “The people who say you should work smart, not hard… pretty much always fail.” Google is his counterexample on the jerk question: Larry Page, Sergey Brin, and Sundar Pichai are, in his telling, pretty nice people, and the culture is one of people who work really, really hard.

09

Open source is a way to build community, not a vow of poverty

Fridman asks a tense question: some of Gosling’s best work outside Java never became as popular as it might have, partly because of licensing. In general Gosling is a big fan of open source — communities, collaboration, faster development. He gets “kind of weird” when it turns into a religion that says all things must be open source. Extreme versions of that, he says, end up claiming that all software engineers must take a vow of poverty, as though it were unethical to have money or build a company.

A slice of him buys the impulse. A patent that arrives like lightning while you lie half-awake can mint billions; luck is luck, until it explodes into something that looks like exploitation. He points at medications that cost a hundred dollars a day. The test he actually cares about is narrower: when something is not open source and is a worse product because of that, that bothers him.

Fridman uses Emacs and apologizes for not using Gosling’s. The default on Linux, Gosling says, started out as the one he wrote, through a strange passage. In the last years of graduate school it became clear he would be Mr. Emacs forever or he would graduate; he could not do both. He might have become wealthy if Emacs had mushroomed into a text-processing product line. He has “a long history of financially suboptimal decisions” because he did not want that life. He asked everyone he knew on the ARPANET to take the code; they had day jobs. Two people in a garage in New Jersey, complete with a dog, would take it over if they could charge money. His condition was that it stay free for universities and schools. That upset some people.

The disagreement with Richard Stallman, as Gosling paints it, is the extreme form of “information must be free”: everyone whose job is producing movies or software must take a vow of poverty. He does not want to be wildly rich, and he is not; he does need to feed his children. Closed source that grows a bureaucracy and hurts the product makes him sad too. The middle path he respects is service and support. Sarbanes-Oxley and accounting rules even push firms to buy support contracts on software they depend on. That is a living. It is not what “truly rapacious” vendors such as Oracle charge. Winner-take-all commerce does not work for him either.

10

Java was squeezed out of a world that kept reinventing pointer bugs

Around 1990 a group at Sun worried that the computing industry was missing what was happening outside it. Elevators, locomotives, factory process control, audio and video gear, and the early glimmers of cell phones all had processors in them, in volumes larger than the traditional computer business. C and C++ absolutely owned that universe. The hunch was not “we need a new language.” It was that something was going on out there, and they needed to understand it. A few of them went on epic road trips: Toshiba, Sharp, Mitsubishi, Sony in Japan; Samsung in Korea; Philips, Siemens, Thomson in Europe. Sun’s name opened doors.

What leapt out was that the consumer-electronics firms were reinventing computer networking and repeating disasters from twenty years earlier. Gosling could look at a design and name twenty-five things that would be complete disasters. What they learned from those companies mattered more. They treated the relationship with the customer as sacred and would not trade reliability for performance. The computer industry did. Cray made division fast with Newton-style approximations; the bottom bits of a quotient were essentially random numbers. Nail the bottom bit, Gosling says, if you put toast in a toaster and do not want the house to burn down.

They decided to understand the market the homely way: build a prototype, a control system for home electronics, TVs and VCRs. They wrote it in C and C++, and standard practice got in the way. A business-plan colleague, an MBA, kept asking outsider questions that forced the engineers to re-examine safety, security, and naked pointers. By the early 1990s it was well understood that the number one source of security vulnerabilities was pointer bugs — 50, 60, 70 percent of them, the vast majority buffer overflows. They had to make that impossible. In 2020, Gosling notes, an examination of Chrome’s vulnerabilities, a giant C++ codebase, found 60 or 70 percent were still “stupid pointer tricks.” Thirty years later. Slap your forehead, he says, and just want to cry.

Pointers were a trigger, not the whole design. Concurrency mattered because waiting on a user-facing device is death. So did recovery from faults, leaks, and the evil twin of a leak: memory that is freed and still used. He had spent an ungodly fraction of his life hunting mystery pointer bugs, maybe two thirds of his time as a developer; they are statistical, one-in-a-million, and at a billion operations a second they happen. He got religious about failing immediately and visibly. Shops that adopted Java often got to a production-quality release much faster, even if the first demo was not quicker. Object-oriented interfaces were also social engineering: he made it hard to sneak through a back door, so the right move was to walk up to the author and change the interface. On a class project you own both sides. Across organizations, clarity saves your life.

11

The JVM started as a purchasing problem and a lazy compiler trick

Fridman calls the virtual machine one of the beautiful ideas in the history of programming. Gosling says the JVM was carefully designed to have more than one reading. One that most people miss: you can view it as an encoding of the abstract syntax tree in reverse Polish notation. The public reading is an instruction set for an abstract machine that can be translated onto a physical one. That mattered because of conversations with purchasing departments in the early 1990s.

Sheet metal, gears, capacitors, and resistors all had multiple sources. CPUs were proprietary and different. Choose Intel and you were an Intel customer until the end of time, because the software was welded to that chip. C was particularly bad at leaking word size, endianness, and floating-point behavior into the program. Purchasing people were driven insane: they had to make an irreversible vendor decision before the first line of software was written. Generations were no kinder. Moving Sun from the Motorola 68010 to the 68020 had differences that sucked a year out of Gosling’s life; he became the point man on the worst of the instruction-cache surprises.

The epiphany came from a graduate-school summer job. His advisors were Raj Reddy and Bob Sproull. The department had Three Rivers PERQ workstations whose instruction set was literally UCSD Pascal p-code, because the hardware company wanted to do as little software as possible. When they needed that software on VAXes, Reddy asked for a translation. Gosling noticed he could rewrite p-code into VAX assembly, and the result was higher-quality code than the C compiler. He thought it was a sleazy hack because he was lazy; it worked. Nobody wanted it as a thesis. Years later, facing a zoo of microprocessors, he thought of multiple translators in that p-code space, talked to Smalltalk people who also used bytecode, and kept both an interpreter (easy) and a compiler (fast). “Most of my good ideas are driven by laziness. Some people’s stupidest ideas are because they’re insufficiently lazy.”

The same instinct became a religious position on arithmetic. Integers would be two’s complement, full stop — not ones’ complement, not decimal. Floating point had been a mess; a numerical library that worked on a CDC would not work on an IBM. IEEE 754 had mostly taken over, with pockets of holdouts. Gosling wanted to be able to say what two plus two means. The biggest fights were with Intel, over strange rounding and stranger transcendental functions in the name of optimization. Their range reduction for sine and cosine used a slightly wrong value of pi.

12

Android crossed lines that did not need crossing; he would rather live in Star Trek

On Android, Gosling has to give a short answer and clearly hates that. He is happy they did it. Java had already been running on cell phones for years, and it worked well. How they did it is the problem. Andy Rubin, who led the effort, “crossed a lot of lines,” and those crossings mushroomed into giant court cases. They did not need to. It would have been so much cheaper not to. Fridman wonders whether nobody anticipated the success. Gosling came to believe it did not matter what Rubin did; it was going to blow up. He started thinking of him as a manufacturer of bombs. Some of the best things in the world come from that kind of explosive — and some of the worst.

Pride is older than Android. Java was in billions of phones before Android arrived. He is just as proud of the smart-card standards that adopted Java, a project he thinks everyone involved did well. The SIM card in your pocket ran Java. That, to him, is the quieter billions.

Asked what he hopes people write about him five hundred years from now, he says: people not being afraid to take a leap of faith. He has a weird history of doing weird stuff that worked out pretty well. Some of the weirder bits were the coolest; well over half of what he has done crashed and burned, which is occasionally really annoying. You keep doing it. Even a crash teaches you something. Advice to young engineers: don’t be afraid of risk. It is OK to do stupid things once, maybe a couple of times. You get a pass on the first time or two. The third or fourth, not so much.

Early on he started putting every technical decision in a science-fiction frame: are you building Blade Runner or Star Trek? Which future would you rather live in? Star Trek, without hesitation. Fridman maps that onto AI: favorite system Data, least favorite Skynet. Gosling agrees, and Fridman ends there. The closer Gosling leaves the show is that one of the toughest things about life is making choices. The through-line from the unwatched PDP-8 to the 300-volt relays to a one-month Emacs to a VM that hates pointer bugs is the same choice: make the world small enough to see, then leap.

Sur la même chaîne

3:36:56EN
Lex Fridman· 16 sept. 2026PodcastPsychiatry Has Never Found Its PenicillinAnime : Lex FridmanHistorian Andrew Scull tells Lex Fridman why the field can ease symptoms, has never cured a major mental illness, and keeps paying for overconfidence with patients' lives.Mental HealthPublic HealthNeuroscience
5:15:51EN
Lex Fridman· 26 août 2026Podcast · 2 voixDHH Did Not Write a Line of Omarchy QuattroInvité : DHH · Anime : Lex FridmanThirteen months after a skeptical conversation with Lex Fridman, the Rails creator describes how Opus 4.5, a swarm of coding agents, and a one-minute Linux installer ended his era of hand-chiseled Ruby.Agents de codeVibe CodingIngénierie d’agents+3
3:12:58EN
Lex Fridman· 12 août 2026Podcast · 2 voixOne Cold Shower, Twenty Champions: How Khabib Nurmagomedov Was ForgedInvité : Khabib Nurmagomedov · Anime : Lex FridmanIn a Makhachkala school gym, seventy men shared one shower, and the water was only cold.Martial ArtsCombat SportsCoaching+3
3:46:18EN
Lex Fridman· 28 juil. 2026Podcast · 2 voixIf You Take Slavery Out of the Picture, There Is No Civil WarInvité : Gary Gallagher · Anime : Lex FridmanIn 1860, enslaved people were worth more than every railroad and factory in the United States combined.Political PhilosophyLeadershipHistory
3:51:47EN
Lex Fridman· 30 juin 2026Podcast · 2 voixForty-Six Percent of Emperors Were Overthrown. The Empire Lasted AnywayInvité : Anthony Kaldellis · Anime : Lex FridmanHistorian Anthony Kaldellis walks Lex Fridman through 2,200 years of Roman history and argues that what we call Byzantium was Rome itself.Political PhilosophyGeopoliticsLeadership
2:53:42EN
Lex Fridman· 29 mai 2026Podcast · 2 voixThe Moon Is Falling. It Just Keeps Missing.Invité : Biggest Mysteries in Physics · Anime : Lex FridmanFermilab physicist Don Lincoln tells Lex Fridman that the history of physics is a history of unification, and that antimatter, dark energy, and a theory of everything still sit far beyond the experiments we can run.Quantum MechanicsScience CommunicationPhilosophy of Science