logoalt Hacker News

friotoday at 12:13 AM4 repliesview on HN

I've been trying to use `Deno` underneath `Rust` so that the tools can still be written in Typescript and thus self-mutated without the compilation step (but I can still try to do clever things with V8 Isolates or similar). It's been an ugly experiment so far; I'm vaguely thinking a simpler model would be to just define a binary "API" and run tools by exec-ing binaries.


Replies

slowhorsetoday at 6:15 AM

I agree v8 and Deno seems very heavy handed and complex to integrate for scripting capabilities.

Have you considered Lua? It is tailor made for use cases like this. Creating an embedded host in Rust is trivial, the work lies in creating built-in functions for the script runtime so that the user scripts can do useful things to the environment.

gidellavtoday at 12:18 AM

I have to be honest and tell you that try to load such an heavy runtime as a scripting layer is not a great idea; at the same time I can tell you that I am working on another Rust project where I also needed scripting, and after three attempts I landed on rhai (https://rhai.rs/) (https://rhai.rs/book).

You might find it nice for pretty much all use cases except for high-performance scripting (so, if you are not try to build the entire logic entirely in rhai, you are going to be fine).

show 2 replies
BillStrongtoday at 2:18 AM

Have you thought about Zig? If you limit it to CompTime, isn't that just a scripting language that happens to be compiled to binary?

show 1 reply
jswnytoday at 12:51 AM

Why not WASM?

show 1 reply