text stringlengths 0 2.02k |
|---|
**Adam Stacoviak:** Yeah. |
**Jerod Santo:** Node was huge immediately -- like, maybe not immediately, but people were very excited about Node, right? |
**Adam Stacoviak:** Yeah. Well, I think there was a lot of things even like with Walmart Labs, and Black Friday... This wasn't back in the 2009 days particularly, but there was a lot of inertia around high-traffic websites, and scalability, and it's enterprise-ready, so a lot of different enterprise teams were happy to... |
**Jerod Santo:** Yeah. So I guess my point is it filled a huge void, and it got a huge rush of enthusiasm and adoption because of that... And then Deno comes out, and it doesn't come out into that same moment in time. It comes out later, when you have a mature Node ecosystem, you have millions of packages on npm. You h... |
**Ryan Dahl:** The first important aspect is that it's written in Rust instead of C++. Node is a very large C++ project, and I'm not sure how you guys feel about this, but I'm very convinced that I will never start another C++ project. Rust really solves the C++ problem, as it were. There's many great things about Rust... |
In Node days, we built a web server and you'd have to parse HTTP, and it's such a difficult problem that we ended up writing our own HTTP parser for this. It's so difficult to bring in external code that you end up often having to just write the stuff over again, because it's so difficult to link. And this is very diff... |
**Jerod Santo:** \[12:31\] Yeah, maybe kind of a feature that end users don't appreciate as well as the authors or maintainers, but they will appreciate over time as you are allowed to continue at a certain pace that the C++ ecosystem didn't allow with Node. Or maybe at a certain point Deno will also get so many lines ... |
**Ryan Dahl:** Sure. Just talking about other aspects of Deno, internally, that are important, is the binding interface; kind of the boundary between JavaScript and the native language, in this case Rust, in Node's case in C++. Node was fairly ad-hoc at adding bindings; we just kind of added them all over the place. Th... |
One of the really nice aspects in Deno is that everything is organized as promises. It's kind of promises all the way. There's not kind of random callbacks that happen throughout the system. |
This was actually a pretty big design mistake. I forget if I did discuss this, or how much I discussed this in the talk, but WebSockets are on my mind right now, because we're doing a lot with WebSockets. WebSockets have this on-message callback, right? |
**Jerod Santo:** Right. |
**Ryan Dahl:** And one of the problems with this is that you can't really stop the system from giving you new messages. You can just get flooded with these callbacks. There's no way to throttle this incoming stuff. So because of the inability to stop these new messages coming in through this WebSocket, you can get into... |
That's quite bad... This actually causes pretty -- this manifests itself in bad tail latency situations, where usually the system is fine, except under pressure, when suddenly one part of the system is getting flooded with these callbacks, so you start getting really bad latencies. |
WebSockets in particular - there's a new STDOUT called WebSocketStream, which addresses this, allowing you to create some back-pressure, that is to not accept the newest message if you're not ready to handle it. And in general, this async/await paradigm, syntax, and the usage of promises everywhere generally kind of so... |
Anyway, that's all to say that Deno is promises all the way down, and so kind of from the fundamental layer we've tried to deal with this back-pressure problem. |
**Jerod Santo:** \[16:02\] Another big differentiator is the package management story, right? |
**Ryan Dahl:** That's right. |
**Jerod Santo:** Tell us about how Deno sees the world of packages. |
**Ryan Dahl:** Yeah, I would bring this back to -- in general, Deno is trying to use web APIs. We try not to introduce invented APIs, like I had to do in 2009 when I started Node; there were just a lot of APIs that were -- you know, there was no module system, so we invented this require syntax to link to JavaScript fi... |
ES modules, ECMAScript modules is a standard now. This is part of the new JavaScript standard, which defines import and export. I'm sure you guys are familiar with it... And this works in web browsers these days. These imports and exports and ways to link different files together. And the way that this works on the web... |
**Jerod Santo:** That's how we used to do it back in the day. We'd just have our script sources, and you'd just have your list of sources. Everything was so simple. |
**Ryan Dahl:** Which is quite nice, right? It's really nice to have an HTML file and just drop in a link to the jQuery CDN and suddenly have that available without having to do a whole installation procedure, right? |
Anyway, Deno is built around the idea that we think this is sufficient, actually, to link remote code together. I mean, the problem is really -- I've got code that I'm developing locally, and I really want to include some third-party library. How do I do that? In the Node system you would download that third-party code... |
Our module system is really the web browser's module system, which is exactly HTTP. So unlike npm, which has a specific protocol for distributing packages, you have to ask the npm server what the latest package is, get the link to the tarball, download the tarball... We don't define a protocol like that. We just have H... |
**Adam Stacoviak:** What are the advantages of that then? If pulling a module for npm, for example, the stability of being able to make those -- npm install, for example, and being able to sit there and wait, like some people might, what are the advantages of that system over this older one? Obviously, it's modern in t... |
**Ryan Dahl:** \[20:02\] I think it has the effect of feeling immediate, and... There's nothing to install ahead of time, because the Deno system itself actually takes care of downloading that. So I would say the other DX effect is that you can have scripts that are single files. In Node, you generally at minimum need ... |
**Adam Stacoviak:** It's minimal. |
**Jerod Santo:** Yeah, it's simple. |
**Ryan Dahl:** It's very minimal. |
**Adam Stacoviak:** You can have file tabbing fatigue, or swapping from different files... I love that a lot -- in a whole different land, with Tailwind, for example, you can do a lot in the same file or in the same HTML file; you're not jumping back from CSS to HTML. So similar to how that world might work, you're not... |
**Ryan Dahl:** When you have a large application, if you have hundreds of files, having one extra package.json file is not a big deal. It's no big deal to have a -- you know, if you have hundreds of modules and you have one extra one, it's not a big deal. So I think in the tail end of larger projects, it probably doesn... |
When you do npm init, it's gonna ask you for (I don't know) the license of your project, the name of your project... All of that stuff is -- let's say you're trying to write a script that's going to rename a bunch of files in a folder. Who cares? I don't care what the license is. Why am I spending any time at all think... |
**Adam Stacoviak:** Yeah. What about the potentially hidden advantage in it? I'm assuming this - the internet essentially is your package manager. You can link to a raw file on GitHub, you can link to some random site, adamstacoviak.com, or changelog.com and just inherit from that. Is that how Deno works? You can just ... |
**Ryan Dahl:** Yeah, that's right. You can pull in files from any server. And the nice side effect of this is that that Node ecosystem and essentially all other programming languages are dependent on a specific server to distribute third-party packages, whether that's crates.io, whether that's golang.org, or npmjs.com.... |
**Jerod Santo:** \[23:56\] Right. Then if GitHub goes down, we're screwed again. But we're already screwed, so... Great website, by the way. I love the dinosaur brand, I love the name. Deno.land is such a cool domain. I just wanted to give you props for that really quick. |
What about versioning? I mean, if I'm a library author, are there idioms around that? Do I just have a new file with like the version in my file name? How do we deal with things like "Lodash 3.7.1 is out. How do I go get it?" |
**Ryan Dahl:** Ultimately, a version is a string of characters, and so is a URL... So you can have a version in a URL to specify the version. Think back to the jQuery CDN example - you have perfect ability to link to any version of jQuery. |
**Jerod Santo:** Good answer. What about existing npm -- are all the existing npm packages then supported if I can find the exact URL of the source code? Will it just work? Or are they using some things that might not be ESM-compatible, and stuff like that. |
**Ryan Dahl:** Yeah, so if it's not using ESM, then it's going to be probably problematic. It may be problematic even if it is using ESM. Unfortunately, we're kind of in a state right now in JavaScript where there's a lot of fragmentation between TypeScript, common JS, Deno, Node... I hate to contribute to that, but I ... |
**Jerod Santo:** Skypack. |
**Ryan Dahl:** So you should be able to access those files through HTTP. And if they're ESM, then you're close to it working. I think the problematic thing is if they use Node APIs. Node for example has requirefs. You can requirefs and open a file. Deno has alternative APIs for that. We do not have a top-level fs modul... |
**Break:** \[26:25\] |
**Jerod Santo:** So Ryan, on your website, deno.land (awesome website) it says "A secure runtime for JavaScript and TypeScript", and of course, "Secure by default" is the top-level bullet of Deno features. We haven't talked about security yet. Do you wanna give us the skinny? |
**Ryan Dahl:** \[27:52\] Yeah, so obviously if you're pulling in random packages over HTTP, you should be worried if you're pulling in code, because maybe you've audited this code, but probably not. That code probably depends on some other code. And those can end up pulling in many dependencies. |
**Jerod Santo:** That's kind of like those installers where they're like "Curl this URL, pipe it into Bash", and then a lot of people will show up in the comments like "Please don't do that, because Bash is gonna execute arbitrary code that's in that URL." Anyways, I cut you off, but I just was reminded of that, where ... |
**Ryan Dahl:** Unfortunately, it's really hard to audit all of your code these days. I mean, we depend on society-level infrastructure, right? There's no possible way -- if you plan to be a productive developer, to go out and actually read through all of the dependencies and the transitive dependencies of your dependen... |
By the way, you're talking about curling Bash scripts - when you npm install something, arbitrary code from the internet is running on your computer, without any security sandboxing. And beware, when you are npm installing something, you are completely and utterly open to having your computer taken over. It takes one b... |
**Adam Stacoviak:** And we've seen that. |
**Ryan Dahl:** We have seen that, yes. This is mitigated in web browsers. Web browsers do not allow you to access your local file system. They do not allow you to do a lot of stuff, right? Web browsers are a secure sandbox. And this is a really nice property of V8 and the JavaScript language, is that it does not necess... |
We, Deno and Node, give access to the system so that you can do things like writing a little script to rename a bunch of files. The purpose of a server-side JavaScript system is to interact with the system. But in Node, we did this without any constraints. We just opened all sorts of holes, so you can access the file s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.