Hacker News new | ask | show | jobs
by FascistDonut 1139 days ago
When/why would you want to do this? I went to pt. 1 but it didn't seem clear.
4 comments

The content of the series describes creating something like the beginnings of a Deno alternative, upon which the reader could fully recreate Deno or Node.js. It seems to me that the core idea presented is "a JavaScript/TypeScript interface to Rust". The thing that most interests me about something like this is not making yet another alternative to Deno or Node.js, but the potential for adding a scripting language to an application or framework written in Rust. I'm thinking like Python scripting of Blender, Lua as a scripting/modding layer for a game engine, scripting of Tiled with JS, an Electron alternative using GTK, your own browser.
When you want to add a sandboxed scripting language to any system, you might implement something like this. For example, a multi-tenant web proxy that lets users script functions for transforming requests, or a game that lets users script the user interface elements, would be two valid use cases.
There's hundreds of programs that can be scripted with embedded Lua. For example, nginx web server, or neovim editor or awesomewm window manager. Having an embedded scripting language gives these systems enormous flexibility & utility.

This series is effectively about doing the same, but embedded Deno instead of Lua. It's showing how to launch Deno runtime, and how to seed those runtime with various hooks to access & manipulate the program it's embedded in.

sounds useful for sandboxing