Hello!
Im curious, if I wanted to make my own programming language, would yall recommend to compile down to WASM or Cranelift. (Let's ignore the obvious advantage WASM has in that it can run in the browser n stuff)
That cannot be answered without more information about your goals and constraints, but my answer is "almost certainly Wasm". :slight_smile:
I ask because I’ve seen a couple of new languages like Scheme-rs use crane lift, (and obviously rust uses it) so maybe it’s like crane lift can do stuff that WASM can’t? (Though rust can ALSO compile down to WASM so….)
I guess the main thing is that wasm is automatically sandboxed and needs to be run in a VM while cranelift compiled down to normal machine code
I think the main factors in either direction are:
If I were designing a new language with a compiler, a Wasm backend would be an easy choice for me -- the universality is worth it. But if you want to play with low-level performance or you want a toolchain that can build native binaries then by all means feel free to play with Cranelift
That makes sense, thanks yall!
Hmm?? Cranelift is a backend of wasm, right? Is there any difference between compiling down to wasm and to cranelift?
Cranelift is a compiler library. Wasmtime uses Cranelift to compile Wasm to machine code. But Cranelift is not Wasm-specific.
Is there any difference between compiling down to wasm and to cranelift?
Put simply, yes. In one case you emit Wasm bytecodes. In another case you emit Cranelift IR.
Last updated: Dec 06 2025 at 05:03 UTC