Design and Goals
Artichoke is a platform for building Ruby implementations. You can build a ruby/spec-compliant Ruby by combining Artichoke core, a VM and parser backend, and the Artichoke frontend.
Artichoke is designed to enable experimentation. The top goals of the project are:
- Support WebAssembly as a build target.
- Support embedding and executing Ruby in untrusted environments.
- Distribute Ruby applications as single-binary artifacts.
- Implement Ruby with state-of-the-art dependencies.
- Experiment with VMs to support dynamic codegen, ahead of time compilation, parallelism and eliminating the GIL, and novel memory management and garbage collection techniques.
artichoke-core contains traits for the core set of APIs an interpreter must
implement. The traits in
- APIs a concrete VM must implement to support the Artichoke runtime and frontends.
- How to box polymorphic core types into Ruby
- Interoperability between the VM backend and the Rust-implemented core.
Some of the core APIs a Ruby implementation must provide are evaluating
code, converting Rust data structures to boxed
Values on the
interpreter heap, and interning
Artichoke core provides an implementation-agnostic Ruby runtime. The runtime in
Artichoke core will pass 100% of the Core and Standard
Library Ruby specs. The runtime will be implemented in a hybrid
of Rust and Ruby. The
Regexp implementation is a representative
example of the approach.
Artichoke core will support embedding with:
- Multiple file system backends, including an in-memory virtual file system.
ENVbackends, including an in-memory
- Optional C dependencies via multiple implementations of Core classes, e.g.
- Optional standard-library.
- Optional multi-threading.
- Capturable IO.
A Rust-implemented Ruby runtime offers an opportunity to experiment with:
- Improving performance of MRI Core and Standard Library.
- Implementing the runtime with state-of-the-art dependencies.
- Distributing single-binary builds.
Artichoke core does not provide a parser or a VM for executing Ruby. VM backends provide these functions.
VM backends are responsible for passing 100% of the Language Ruby specs.
VM backends offer an opportunity to experiment with:
- Dynamic codegen.
- Parallelism and eliminating the GIL.
- Memory management and garbage collection techniques.
Artichoke will include
irb binary frontends with
dynamically selectable VM backends.
Artichoke will produce a WebAssembly frontend.
Artichoke will include implementation-agnostic C APIs targeting: