4 ms·
Bun is an executable as far as I understand. Would it be possible to call Bun directly from another language with bindings? For example Erlang (and Elixir) has
by POiNTx 3y ago
Bun is an executable as far as I understand. Would it be possible to call Bun directly from another language with bindings?
For example Erlang (and Elixir) has Native Implemented Functions[0] (NIF) where you can call native code directly from Erlang. Elixir has the zigler[1] project where you can call Zig code directly from Elixir.
Maybe you can see where I'm going with this, but it would be super cool to have the ability to call Javascript code from within Elixir. Especially when it comes to code that should be called on the server and client. I'm the developer of LiveSvelte[2] where we use Node to do SSR but it's quite slow atm, and would be very cool to use Bun for something like this.
In any case Bun is super impressive, keep it up!
[0] https://www.erlang.org/doc/tutorial/nif.html https://www.erlang.org/doc/tutorial/nif.html
[1] https://github.com/E-xyza/zigler https://github.com/E-xyza/zigler
[2] https://github.com/woutdp/live_svelte https://github.com/woutdp/live_svelte
- Jarred 3y agoYes it would be possible, though it'd be easier to start in Bun and then call out to your executable from JavaScript via napi or bun:ffi