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.
The traits in Artichoke core define:
- Capabilities of a VM backend.
- Capabilities of a
Ruby
Value
. - Interoperability between the VM backend and the Rust-implemented core.
Example capabilities a Ruby implementation must provide include evaluating code, declaring classes and modules, and exposing top self.
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 filesystem backends, including an in-memory virtual filesystem.
- Multiple
ENV
backends, including an in-memoryHashMap
backend. - Optional C dependencies via multiple implementations of Core classes, e.g.
Regexp
. - 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.
Artichoke currently includes an mruby backend. There are plans to add an MRI backend and a pure Rust backend.
VM backends are responsible for passing 100% of the Language Ruby specs.
VM backends offer an opportunity to experiment with:
- Dynamic codegen.
- Compilation.
- Parallelism and eliminating the GIL.
- Memory management and garbage collection techniques.
Artichoke will include ruby
and irb
binary frontends
with dynamically selectable VM backends.
Artichoke will produce a WebAssembly frontend.
Artichoke will include implementation-agnostic C APIs targeting: