Robin Templeton (they/them) <robin@spritely.institute>
David Thompson (he/him) <dave@spritely.institute>
SeaGL 2023
Hi, we're Robin and Dave!
We work for the Spritely Institute.
We are building decentralized, secure infrastructure and standards for networked communities!
We are a 501(c)(3) non-profit, research institution
Distributed, transactional programming with a security model you can understand.
"If you don't have it, you can't use it!"
An open standard for the next generation of networked communities.
Pre-standardization effort happening now!
It is 1995:
It is 2013:
i31
)Let's take a closer look at how Spritely is using WASM to bring Guile to the web.
"Bring your whole self." — Andy Wingo
This is the update loop for a particular cellular automaton:
(define (update from to)
(do ((y 0 (+ y 1)))
((= y grid-size))
(do ((x 0 (+ x 1)))
((= x grid-size))
(let* ((t (grid-ref from x y))
(t* (cond
((= t empty) empty)
((= t cu)
(if (<= 1 (neighbors from x y) 2) ehead cu))
((= t ehead) etail)
((= t etail) cu))))
(grid-set! to x y t*)))))
Can we run it in a web browser?
Welcome to Wireworld!
Cybersol by David Wilson (System Crafters, Flux Harmonic)
Hoot provides a new compiler backend for Guile
Scheme → Guile Bytecode WASM
Upcoming Firefox 121 and Chrome 119 have it all!
Should be in stable releases of all major browsers by early 2024.
(except stringref... more on that later.)(define (port? x)
(%inline-wasm '(func (param $obj (ref eq))
(result (ref eq))
(if (ref eq)
(ref.test $port (local.get $obj))
(then (ref.i31 (i32.const 17)))
(else (ref.i31 (i32.const 1)))))
x))
guild
tool for hooking into build systemsscheme@(guile-user)> ,use (wasm wat) (wasm resolve) (wasm vm)
scheme@(guile-user)> (define wasm
(resolve-wasm
(wat->wasm
'(module
(func (export "fmod")
(param $x f64) (param $y f64) (result f64)
(f64.sub (local.get $x)
(f64.mul (f64.trunc
(f64.div (local.get $x)
(local.get $y)))
(local.get $y))))))))
scheme@(guile-user)> (define instance (instantiate-wasm (validate-wasm wasm)))
scheme@(guile-user)> ((wasm-instance-export-ref instance "fmod") 4.3 2.0)
$1 = 0.2999999999999998
scheme@(guile-user)> ,use (hoot reflect) (wasm parse)
scheme@(guile-user)> (define reflector
(call-with-input-file "js-runtime/reflect.wasm"
parse-wasm))
scheme@(guile-user)> (define hoot-square
(compile-value reflector '(lambda (x) (* x x))))
scheme@(guile-user)> hoot-square
$1 = #<hoot #<procedure>>
scheme@(guile-user)> (hoot-square 4)
$2 = 16
Learn more about Hoot:
https://spritely.institute/hoot
Join our community forum! (use code OCAPN2023)
https://community.spritely.institute
Chat with us!
#spritely
on irc.libera.chat