4 ms·
ELI5: Why not use typescript and an embedded v8 engine or deno to run them? What kind of advantages will I miss if I go for typescript as an embedded language f
by lewisjoe 1y ago
ELI5: Why not use typescript and an embedded v8 engine or deno to run them? What kind of advantages will I miss if I go for typescript as an embedded language for my application?
Also by using v8, I open up new possiblities via wasm (write in any lang and run it here?)
Will be helpful if somebody enlighten me.
- airstrike 1y agoWhy would I want to bundle an entire JS runtime? And why do you think you need that for WASM? And personally I will go out of my way to not use TS/JS if I can
- ijustlovemath 1y agosounds like it's not fast enough for their use case. plus, have you ever tried to integrate v8 into a project? Deno is fine for building binaries, but to date doesn't really have good support out of the box for bundling a script into a library, which this application seems like it would need.
- duped 1y agoBe warned that V8 is a behemoth and adds 100+MB to your binary size, is quite slow to link, and is not practical to compile from source for most projects. If you want a lighter weight JS runtime there's quickjs, if you want WASM there's wasmtime. Personally I don't think it's a good choice for what it seems Roto is used for (mission critical code that never crashes) since TS doesn't have a sound typesystem and it's still very easy to fuck up without additional tooling around it.
- giancarlostoro 1y agoThere's also Duktape for just JS minus the WASM (at least I don't think they've implemented WASM yet). https://duktape.org/ https://duktape.org/
- ijustlovemath 1y agoI think QuickJS wins over Duktape for ES5 compliance, though it's been a few years since I was evaluating embedded JS. They're both extremely easy to integrate into an application, in contrast to V8
- giancarlostoro 1y agoFair, I'm not quite as familiar, but always like to bring up alternatives in case they're helpful. My favorite HN comments lead me to new alternatives for programming.
- giancarlostoro 1y agoYou are comparing a general purpose scripting language (TypeScript) to a DSL (Domain Specific Language) essentially. They built theirs with a specific purpose.
- skybrian 1y agoRoto is a very limited scripting language with no loops. You might compare it with the eBPF language used to load filters into the Linux kernel.