November 18th, 2022 × #javascript#nodejs#deno#typescript
Supper Club × Ryan Dahl and Deno
Ryan Dahl discusses the origins and goals of Deno, his new JavaScript/TypeScript runtime, and why he believes JavaScript will remain the language of the web.
- Introduction
- Wes introduces the podcast with Ryan Dahl
- Wes and Ryan talk about Node's early days
- Ryan discusses why he still believes in JavaScript
- Ryan talks about the uncertain future of web in 2012
- Ryan says JavaScript will still be here in 5-20 years
- Ryan calls JS the default programming language
- Wes asks Ryan why he made Deno
- Ryan talks about handing off Node to Linux Foundation
- Ryan discusses Node's outdated C++ codebase
- Ryan says Rust has replaced C++
- Wes agrees on Rust hype
- Ryan clarifies Rust no faster than C++
- Ryan praises Rust's architecture
- Ryan wanted to improve JS security
- Ryan regrets lack of security in Node
- Deno started as Node 2.0 experiment
- Goals of Deno
- Scott asks about Deno's bet on TypeScript
- Scott says TS is how we write JS now
- Wes asks Ryan's thoughts on TypeScript
- Ryan sees TS as JS 2.0
- Ryan praises conservative design of TS
- Ryan discusses adding types to JS spec
- Wes jokes about CoffeeScript revival
- Ryan dislikes CoffeeScript syntax
- Wes asks if TS will be added to browsers
- Ryan doesn't think browsers will do type checking
- Ryan thinks browsers will support TS comments
- Wes asks how Deno is made
- Ryan explains using V8 and Rust
- Ryan talks about Deno's async runtime
- Deno uses Tokio instead of libuv
- Ryan optimized binding JS to native code
- Ryan says Deno supports NPM modules
- Ryan talks about benchmarking Deno vs Node
Introduction
Announcer
I sure hope you're hungry.
Announcer
Cool. I'm starving.
Announcer
Wash those hands, pull up a chair, and secure that feed bag, because it's time to listen to Scott Talinsky and Wes Boss attempt to use human language to converse with and pick the brains of other developers.
Announcer
I thought there was gonna be food, so buckle up and grab that old handle because this ride is going to get wild.
Announcer
This is the Syntax supper club.
Wes introduces the podcast with Ryan Dahl
Wes Bos
Welcome to Syndax, the podcast with the tastiest web development treats out there. Today, we've got a very Exciting episode for you. We have Ryan Dahl on who is probably no creator of Node. Js and most recently creator of Dino. We've been And a whole lot about Dino on this podcast, so pretty stoked to have him on.
Wes Bos
My name is Wes Bos. I'm a developer from Canada. With me as always is mister Scott Talinski. Ski, you know about Scott. Hey. Ryan, thanks so much for coming on. Hello.
Wes and Ryan talk about Node's early days
Wes Bos
Glad to be here. Today, we're sponsored by 3 awesome company. Gatsby, the fastest Front end for the headless web. Sentry, error exception of performance tracking, insanity, the structured content that powers remarkable digital experiences. We'll talk about all of them partway through the episode. I so I'm I'm doing a little bit of a fanboy moment now because I honestly owe A large amount of my career to you because I remember sitting this was, what, probably 12, 13 years ago, I watched It's your 2009 JSConf talk and explaining this server side JavaScript thing, and everybody's like, what the heck? What is this? And I didn't I don't think I totally understood what it was, but I was like, I'm gonna keep tabs on this node thing. And here we are, what, 13 years later, and it's a good chunk of my career.
Guest 3
Yeah. So yeah. Yeah. I think there's a lot of people who watch that from the PHP world at this at the time being like, well, why would I use this instead of PHP? And, like, yeah. Sure enough. Yeah. Many years later, that's all we do.
Guest 2
There there was there was one early talk that I gave at a, a PHP meetup in San Francisco.
Guest 2
And I I think, yeah, Node Node really really was, like, an, nice alternative for for those coming from PHP in in Kind of
Wes Bos
2010, 2011 era. Yeah. It definitely was. And it's funny because I was I was at a point in my career where, like, I didn't really have any of the problems in my programming career that you were talking about solving, but, like, I was on board.
Ryan discusses why he still believes in JavaScript
Wes Bos
So I'm gonna start I'm gonna start with this question, and we'll get into what Deno is and everything like this. But, so you obviously created Node. Js. You are Very smart guy. Know a lot about programming languages in general. I've I've listened to you talk about a lot of stuff. Why all these year late Liz years later, why are you still betting on JavaScript? Why is JavaScript still the language to build for for the web? It's it's a good question. I I I you know, if if you think about it, like, around the year
Ryan talks about the uncertain future of web in 2012
Guest 2
2012 or so. It wasn't super clear that the web was going to be what it is Today, right, mobile mobile apps were coming out, and it was kind of like there is there is kind of a, you know, uncertainty in the air that that, Oh, actually, maybe, you know, Wikipedia is just going to be a iPhone app, and we you know, somehow maybe we're This was just a a little thing that happened in in kind of the late nineties and and 2000, and web browsers would go away. But I think here in in, 2022, I you know, it's it's it's ever more clear that, like, the web is the medium of Human communication.
Guest 2
Right? Like, there's web interfaces to your bank. There's web interfaces to The government there's web interfaces to social media, obviously.
Guest 2
We we interact through the web we're talking through the web right now.
Ryan says JavaScript will still be here in 5-20 years
Guest 2
And, because of that, I I think it's it's fair to say that, you know, web browsers and web technology is going to be here 5 years from now, if Not 10 or even 20 years from now. And because of that, like the protocols that make up the web, the specifications, that is HTTP, CSS, HTML, and JavaScript will still be here, 5, 10, 20 years from now. And so I I think in in a very real sense, JavaScript has become the default programming language.
Ryan calls JS the default programming language
Guest 2
It's Weird, and it's not what anyone would sit down to design if if you were trying to make something beautiful. But that's also what makes it interesting too. I mean, it's it's this kind of organic thing that has grown out of, early beginnings and and kind of un unclear circumstances into the thing that that is is powering, human communication right now. And, it's just exciting to see all of the development and things that you can do with it. And, Of course, the the large developer base of people who who know essentially every programmer, you know, whether you're you're, like, a hardcore back end person or or or not. I mean, you you all everybody knows JavaScript to some degree. Right? And I I think that's that's pretty exciting, and and so I think, there's There's still there's still more to do there. Let's talk let's talk about Deno. So explain to us
Wes Bos
what it is. Why did you make Deno? Why not Node. Js, you already made 1 JavaScript framework.
Wes asks Ryan why he made Deno
Wes Bos
Why another one? A runtime, I guess. Yeah. Yeah.
Guest 2
So I I think Around 2015 or so, Node has been handed off in into the Lenox Foundation, and is is managed as, a nonprofit.
Ryan talks about handing off Node to Linux Foundation
Guest 2
Node has is this big c plus plus code base that's, is having difficult kind of keeping up with the changing times. Like JavaScript as as a whole is kinda moving forward with breakneck speed. And and, I mean, in particular, changes like ECMAScript modules and TypeScript are becoming part of of the day to day, usage of of JavaScript. And Node is just not moving. It's it's it's very slow and, not really incentivized to to to, make major changes there.
Ryan says Rust has replaced C++
Guest 2
At the same time, in in kind of the the The native language front is is developing, quite quite rapidly. And in particular, like, Rust has has essentially, in my mind, replaced c plus plus.
Wes Bos
And there yeah. No kidding. It seems like every day, we have a new Rust library come out. This thing is built in Rust, and it's a 1000000 times faster.
Wes agrees on Rust hype
Guest 2
I I mean, I I you know, Rust is no faster than c plus plus, but but, you know, what's nice is that it you can build larger projects with it. It's it scales better.
Ryan praises Rust's architecture
Guest 2
You're you have the ability to combine different rust crates much more easily than you can different, c plus plus projects and and hacking together, CMake.
Guest 2
So there there there seems to be a lot more to do with with, server side JavaScript, and And kind of moving to ECMAScript modules, moving to TypeScript, trying to be more secure. I've always regretted what what happened with With Node not really using the JavaScript sandbox as it as it was as a security mechanism.
Ryan regrets lack of security in Node
Guest 2
And you've seen all of these these exploits that are happening with With, Left Pad and and various other, NPM modules that that you know, just basically supply chain attacks Because node is has no security guarantees.
Guest 2
And, yeah, we we really Started playing around with with Deno as an experiment to kind of look at what what a node 2.0 would would, would look like.
Deno started as Node 2.0 experiment
Guest 2
And lo and behold, lots of people were interested and and were contributing, and and we we started working on it more. And, Yeah.
Goals of Deno
Guest 2
It's it's, it's it's it's now been a couple of years. But our our main goal with with Deno is is To make it the the easiest, the fastest, and the most secure, server signed JavaScript runtime.
Scott asks about Deno's bet on TypeScript
Guest 3
Nice. And so, obviously, there was, like, a big bet on TypeScript here to say, This is the way that we're we're going to write JavaScript is through through TypeScript.
Guest 3
And and TypeScript is largely could become, like, the way to write JavaScript, at least in the past couple of years here, where you hardly see people working without it nowadays.
Scott says TS is how we write JS now
Guest 3
Well, maybe not In the big picture, but Yeah. You're gonna make a couple of people mad with that guy, Scott, in in small in a small capacity here. But What what are your thoughts on, you know, how TypeScript fits into this landscape here given the fact that it's what is it? Microsoft owned.
Guest 3
Should types be added to JavaScript? Is is TypeScript going to become just straight up JavaScript? Like, what what are your thoughts there? Yeah. I I I see TypeScript as essentially
Wes asks Ryan's thoughts on TypeScript
Guest 2
JavaScript 2 point o. I mean, it's it I think the the the the TypeScript team did an amazing job where they could have done any they they have a full compiler, So they could have done anything, but they were very restrained in only extending JavaScript to add types onto it.
Ryan praises conservative design of TS
Guest 2
And that's That's a very nice design because that means that you can strip the types away with with a very fast compiler pass and get raw JavaScript out of it. So Now we're seeing these proposals in TC 39.
Ryan discusses adding types to JS spec
Guest 2
Only stage 1 right now, but types as comments, which essentially would allow web browsers To natively consume TypeScript, and strip out those types essentially. You know, the the colon type part part of of The of the syntax would just be, ignored as a comment. Of course, the web browser wouldn't do the type checking itself. But, I I I think this is the direction that the language is going. It's going to take quite a while, and it's unclear if, like, exactly TypeScript is what it's going to look like. Yeah. Like, maybe maybe there'll be some more iteration there, but it it's something very similar to this for sure. I think we're we're narrowing in on this. It's just clear that that TypeScript allows you to build, more robust applications. Right? You you can just link together bigger chunks of Code more more sanely. Is it gonna be a CoffeeScript
Wes Bos
revival? Yeah. Maybe CoffeeScript's gonna come back.
Wes jokes about CoffeeScript revival
Guest 2
I I think not. The the The, sig the the indentation stuff in in CoffeeScript is a little sus in in my opinion.
Ryan dislikes CoffeeScript syntax
Wes Bos
Yeah. Yeah. So do you think the the TypeScript thing will ever be a browser thing, or do you think it's always just gonna be, like, a author time and it gets stripped? Either the browser strips it out as comments or it's a compile step. Yeah. The type checking algorithm itself is,
Ryan doesn't think browsers will do type checking
Guest 2
very Inherently slow because you kind of have to traverse this big graph of of all of the the the objects.
Ryan thinks browsers will support TS comments
Guest 2
So I I don't think the browser will ever do the type checking, but but I think the browser will do the type scripting. It's going to take 5 years Or so to to actually get that in place. But but, yes, I I I think there's a lot of support for for that future. Okay. So another question about Dino. Like, how do you how do you make a JavaScript runtime? Do you just go download a a copy of Chrome and rip out the v eight from it? And, like,
Wes Bos
How come how come you can make Deno so much faster than than Node is? So yeah. I mean, we we
Wes asks how Deno is made
Guest 2
I'm I'm a I'm a VA expert. Right? I've been working on with this for for for many years now. And and my cofounder, Bert, also is is, is a early node developer. So So, yeah, we we know how to use v eight. And, Yeah. It's essentially ripping ripping it out of of chrome, although, you know, with lots of Lots of caveats to to that.
Ryan talks about Deno's async runtime
Guest 2
I I you know, the the way that we make it faster is is with a better async runtime. So in Rust, we're using something called Tokyo.
Deno uses Tokio instead of libuv
Guest 2
It's a it's a async event loop, that is similar to our earlier work, Libuv that we wrote for for Node.
Ryan optimized binding JS to native code
Guest 2
We we are just very careful at how we we are kind of binding JavaScript to native code and put a lot of time into into optimizing that.
Guest 2
So what's what's Kind of fun is is, Deno Deno now is supporting NPM modules. And so if you, you can take The basic, say, express server example, and, run that in in Deno, just just with, Import npm colon express.
Ryan talks about benchmarking Deno vs Node
Guest 2
And you can you can try to benchmark that in in node and and, you know, and and,