Quoin
/kɔɪn/ · pronounced “coin”
A small language built from blocks — and the messages they pass.
Quoin is a Smalltalk-inspired programming language running on a virtual machine written in Rust. First-class blocks, message passing all the way down, and multi-method dispatch at the core.
- Blocks are values. Closures you can pass, store, and send messages to — the unit you build control flow from.
- Everything is a message. Even control flow is just ordinary method calls, so there's very little syntax to learn.
- Multimethod dispatch. One selector, many definitions — chosen by argument type and guards, not just the receiver.
- Stackful fibers. Coroutines you can yield from anywhere — generators and lazy sequences fall out for free.
- A Rust VM underneath. Small, memory-safe, and fast.
A taste of Quoin
"* Classes with <- , methods with -> , and blocks are { } Point <- { |@x @y| dist -> { ((@x * @x) + (@y * @y)).sqrt } } p = Point.new:{ x = 3; y = 4 } p.dist "* 5 "* No control-flow keywords — if: is just a message to a boolean (p.dist > 4).if:{ 'far'.print } else:{ 'near'.print } "* Blocks are values — hand one to a collection #(1 2 3 4 5).collect:{ |n| n * n } "* #(1 4 9 16 25)
Fibers — coroutines, built in
"* A Fiber is a coroutine — it yields a value, then pauses "* with all its state intact until you resume it. fib = Fiber.new:{ a = 0; b = 1 { true }.whileDo:{ Fiber.yield:a; t = a + b; a = b; b = t } } fib.resume "* 0 fib.resume "* 1 fib.resume "* 1 fib.resume "* 2 "* Wrap that same yielding block in a Generator and you get "* a lazy, infinite sequence you can take from: fibs = Generator.from:{ a = 0; b = 1; { true }.whileDo:{ ^> a; t = a + b; a = b; b = t } } fibs.take:10 "* #(0 1 1 2 3 5 8 13 21 34)In active development