The Birth of the Idea
Rust compiler is awesome in the era of AI.
But the only problem is, it's too heavy.
Sometimes, I miss typescript + deno a lot.
- Able to import
https://git/foo.tsdirectly - Zero build
- Type safe
- Easy patching using import map
Suddenly, I come up with an idea.
The way to achieve this.
- Why not let rust able to also be zero build scripting language?
Less performance, but imaging zero build + Rust type system correctness!
Just thinking about it already makes me excited.
Target Audience and Use Cases
In the era of AI, rust-repl aim at making rust as zero build scripting language with 100% correctness in fast development.
Trade off the performance of C‑level applications for the rapid iteration of JS‑level applications.
rust-repl should compactible with Cargo.toml.
rust-repl to rust is like
nodedenobunbrowserstojavascriptpythonpypyjythonmicropython... topython
rust-repl should benchmark script engine performance against
nodedenobunbrowserspythonpypyjythonmicropython...
Including
- script launch speed
- script engine speed
rust-repl is likely jit
-
like
nodedenobunpypyarejit -
like
pythonis notjit
No goal
- compare
rust-replscript engine speed with C‑level native applications speed
migration
Before
.cargo/config.toml
[build]
rustc-wrapper = "sccache"
$ cargo run --profile dev
...
Hello, world!
After
rust-toolchain.toml
[toolchain]
channel = "nightly-{{XXX}}"
components = ["rust-repl"]
.cargo/config.toml
[build]
rustc-wrapper = "/dev/null"
$ rust-repl ./src/main.rs
Hello, world!
cargo script vs rust-repl
`cargo script` vs `rust-repl`
Not same with cargo script.
rust-repl is zero build.
cargo script is not zero build.
.cargo/config.toml
[build]
rustc-wrapper = "/dev/null"
$ cargo -Zscript ./src/main.rs
...
error: could not execute process `/dev/null /path/to/rustc -vV` (never executed)
...
Additional
Maybe also offer fast patching.
Like deno import map.
{
"imports": {
"foo": "https://git/heads/main/foo.rs"
},
"scopes": {
"./legacy": {
"bar": "https://git/tags/0.0.1/bar.rs"
},
"./new": {
"bar": "https://git/tags/1.0.0/bar.rs",
"baz": "crates:baz@1.0.0?features=[]",
},
"crates:baz@1.0.0?features=[]": {
"./src/xxx.rs": "./patches/baz_xxx_with_patch.rs"
}
}
}