days
-4
-2
hours
0
0
minutes
-1
-1
seconds
-5
-6
search
JAX Developers Puzzle deadline approaching: Play for a chance to win a complimentary JAX London 2018 ticket!
Node, scrambled

Ryan Dahl is fixing his Node.js design regrets with Deno

Jane Elizabeth
Deno
© Shutterstock / ProJoe Productions

Sometimes, we make mistakes. When we do, it’s important to fix them. But what happens when your mistakes are a part of one of the most popular run-time environments in the world? Ryan Dahl, the creator of Node, intends to fix those mistakes with a brand new TypeScript runtime called Deno.

There’s probably a word for the feeling of irritation and regret when you notice a prominent typo in a project you’ve already handed in or gotten printed. But how does that compare when you develop an entire run-time environment?

For the creator of Node.js, Ryan Dahl, the cracks in his creation are bigger than ever. This has prompted the development of Deno, a run-time environment for TypeScript written in Go and V8.

How do you solve a problem like Node.js?

Developed nearly a decade ago, Node.js was designed to use server-side JavaScript to manage event driven HTTP servers. But while that was important in 2009, things have changed.

As time has gone on, Dahl has regrets. A lot of them. In a recent presentation at JavaScript Conference in Berlin, Dahl gave a talk called “10 Things I Regret About Node.js”. Some of those regrets included getting rid of promises, security issues, the entire build system, packages, node_modules, and more.

So, given the chance to make things right, Dahl rolled up his sleeves and got to work.

SEE ALSO: Node.js 10 is here!

Introducing Deno

Deno is a secure TypeScript run-time on V8. It’s currently written in Go, but will be redone in Rust to avoid potential garbage collector issues. This new open source project is not explicitly compatible with Node.js.

The bones of Deno might be similar to Node.js, but it’s the focus on security and a more lightweight system that make this new TypeScript runtime intriguing. In particular, Dahl highlights Node’s security issues as one of his major regrets about his last project.

This time, Deno takes full advantage of the fact that JavaScript is a secure sandbox. By default, scripts should run without any write access to the network or file system. Users can opt in to access via flags, making it possible for them to run untrusted utilities like a linter.

Additionally, Deno does not allow arbitrary native functions to be bound into the V8. System calls are done by message passing. Since there are only two native functions – send and recv – it makes the design simpler and easier to audit.

Deno

Other goals include simplifying the module system. Now, imports provide an extension and remote URLs are fetched and cached indefinitely on the first load. They are only reloaded if specified.

Plus, Deno gets rid of a package manager. Instead, it relies on the NPM package manager. “There are no packages even,” Dahl said. “You only link to JavaScript files—like you do in the web.”

Deno also reflects Dahl’s appreciation for TypeScript, which he calls “absolutely beautiful”. TypeScript allows code to grow and scale from small hacks to large infrastructure.  The TypeScript compilers allows developers to do module resolution and incremental caching of build artifacts. (Technically speaking, normal JavaScript should work too, since TypeScript is just a superset of JavaScript.)

SEE ALSO: Node.js 2018 User Survey: Docker is still number one and Go reaches new heights

Getting Deno

Deno isn’t intended to disrupt the Node.js community, but solve the problems of 2018 rather than 2009. Right now, this project is very much still a prototype and lots of features are still under development. Developers interested in pitching in should head on over to Deno’s GitHub page for more information.

Author
Jane Elizabeth
Jane Elizabeth is an assistant editor for JAXenter.com.

Leave a Reply

Be the First to Comment!

avatar
400
  Subscribe  
Notify of