Crates.io | scheme-rs |
lib.rs | scheme-rs |
version | |
source | src |
created_at | 2024-12-03 20:41:29.318178 |
updated_at | 2024-12-03 20:41:29.318178 |
description | Embedded scheme for the async-rust ecosystem |
homepage | https://github.com/maplant/scheme-rs |
repository | https://github.com/maplant/scheme-rs |
max_upload_size | |
id | 1470629 |
Cargo.toml error: | TOML parse error at line 18, column 1 | 18 | autolib = false | ^^^^^^^ unknown field `autolib`, expected one of `name`, `version`, `edition`, `authors`, `description`, `readme`, `license`, `repository`, `homepage`, `documentation`, `build`, `resolver`, `links`, `default-run`, `default_dash_run`, `rust-version`, `rust_dash_version`, `rust_version`, `license-file`, `license_dash_file`, `license_file`, `licenseFile`, `license_capital_file`, `forced-target`, `forced_dash_target`, `autobins`, `autotests`, `autoexamples`, `autobenches`, `publish`, `metadata`, `keywords`, `categories`, `exclude`, `include` |
size | 0 |
Scheme-rs is a work-in-progress implementation of the R6RS specification of the scheme programming language that is designed to work with async Rust runtimes like tokio. In essence, it is a embedded scripting language for the async Rust ecosystem.
Scheme-rs is intended to be fully compliant with R6RS, and R7RS large when it is eventually released. To that end the bones are mostly there but some key issues remain.
Eventually, I would like scheme-rs to be more opinionated in the extras it provides, and include a package manager. That is obviously a long way away.
A REPL is the default entry point for scheme-rs at the current moment. You can access it by running cargo run
in the repo's root directory:
~/scheme-rs> cargo run
Finished `dev` profile [unoptimized + debuginfo] target(s) in 0.03s
Running `target/debug/scheme-rs`
>>> (+ 5 5)
$1 = 10
Scheme-rs provides a builtin
function attribute macro to allow you to easily define builtins. For example,
here is the definition of the number?
builtin in the source code:
#[builtin("number?")]
pub async fn is_number(
_cont: &Option<Arc<Continuation>>,
arg: &Gc<Value>,
) -> Result<Gc<Value>, RuntimeError> {
let arg = arg.read().await;
Ok(Gc::new(Value::Boolean(matches!(&*arg, Value::Number(_)))))
}
In the end, it all comes down to call with current continuation. Guile implements this feature by copying the stack, an action which is obviously problematic when considering ref counts and locks. Scheme-rs remedies this by providing all functions with the current continuation so that they may handle it properly. Additionally, the current continuation only contains references and not locked variables.