1 of 15

Deno

Ryan Dahl

2019.04.24

JS.LA

2 of 15

Disclaimer

This talk is aimed at experienced enthusiasts

If this isn't you: Don't Panic

Ignore this talk - use Node. Node isn't going anywhere!

3 of 15

Deno is a new command-line runtime

for executing JavaScript and TypeScript

Primarily it is built on top of:

  • V8
  • Rust
  • Tokio (event loop)
  • TypeScript

4 of 15

But why!? Isn't this exactly what Node does?

JavaScript (both the language itself and the ecosystem around it) has changed significantly since Node was designed in 2009. Notably:

  • Promises / Async / Await
  • ES Modules
  • Typed Arrays

Node has problems:

  • A poorly designed module system, with centralized distribution.
  • Lots of legacy APIs that must be supported.
  • Security.

(These problems aren't unique to Node. Python and Ruby suffer similarly)

5 of 15

I want a fun and productive system for scripting.

A good scripting platform is too useful of a tool to shrug and accept the status quo.

I find neither Node nor Python nor Ruby nor any other dynamic language platform satisfactory.

6 of 15

Deno attempts to correct design mistakes in Node by radically breaking compatibility

  • ES modules are the one and only module system
    • HTTP URLs are used to link to third party code
    • Deno has the ability to fetch resources itself, so it is its own package manager.�
  • Deno is secure by default
    • Users must give extra permission to access the disk, network, or otherwise do privileged operations.�
  • Deno maintains browser compatibility
    • The subset of Deno programs which are written completely in JavaScript and do not use the global Deno object should also run in a modern web browser without change.

7 of 15

V8 (C++)

Deno (Rust)

deno::Isolate (Rust)

Uint8Array

Internal Design (VERY VERY simplified)

Deno.core.send()

Deno.core.recv()

JS

8 of 15

Demo 1

deno help

REPL

Deno.metrics()

cat program

9 of 15

Deno is (kind of) like an OS

Linux

Processes

Syscalls

File descriptors (fd)

Deno

Web Workers

Ops

Resource ids (rid)

10 of 15

Demo 2

location.href

import.meta

deno types

11 of 15

Demo 3

http server

file_server

12 of 15

Embedding Deno

https://crates.io/crates/deno

Deno is released as a standalone executable, but it's also embeddable as a Rust crate.

Potential use cases:

    • Databases often use a JavaScript for Map Reduce functions
    • Serverless products like Lambda@Edge or Cloudflare Workers

13 of 15

Roadmap: Aiming for 1.0 by end of summer

Soon:

  • I/O performance issues
  • TLS (HTTPS)
  • Lock file for external modules
  • Hook into chrome debugger

Eventually:

  • File system events
  • WebGL

14 of 15

Deno is an open collaboration of many people.

Contributions welcome!

15 of 15

Thanks!

Comments? Questions? Concerns?

ry@tinyclouds.org

These slides: http://bit.ly/deno-jsla