Guile Hoot v0.2.0 released!
Dave Thompson —We are excited to announce the release of Guile Hoot v0.2.0! Hoot is a Scheme to WebAssembly compiler backend for Guile, as well as a general purpose WebAssembly toolchain. In other words, Scheme in the browser! It has been a busy two months since 0.1.0, and we've got a lot of goodies to share.
Highlights
-
Nearly all of R7RS-small is now implemented! Hoot 0.2.0 is now capable of running many more standard Scheme programs than 0.1.0.
-
A foreign function interface (FFI) has been added to make it easy to declare imported host functions and call them from Scheme.
-
User-defined record types, sorely missing from 0.1.0, have been added.
Read on for a detailed list of changes.
R7RS-small
-
Added record types and
define-record-type
syntax. -
Added
read
. -
Added
case-lambda
andcase-lambda*
. -
Added system timer procedures
current-second
,current-jiffy
, andjiffies-per-second
. -
Added promise procedures
make-promise
,promise
, ``delay,
force, and
delay-force`. -
Added
string->symbol
. -
Added partial
string->number
implementation. -
Added character procedures
char-upcase
,char-downcase
,char-titlecase
,char-upper-case?
,char-lower-case?
,char-alphabetic?
,char-whitespace?
,char-numeric?
,digit-value
,char-ci<?
,char-ci<=?
,char-ci=?
,char-ci>=?
, andchar-ci>?
. -
Added mutable string procedures
string-set!
,string-copy!
, andstring-fill!
. -
Added stubs for
command-line
,get-environment-variable
, andget-environment-variables
procedures that do not make much sense in a web context. -
Added integer flonum support for
quotient
,remainder
, andmodulo
. -
Fixed
string->?
. -
Fixed
assq
,assv
, andassoc
. -
Fixed
memq
,memv
, andmember
. -
Fixed
gcd
,expt
, andexact
. -
Fixed
finite?
,infinite?
, andnan?
. -
Fixed
peek-char
andread-char
for multibyte chars.
Non-standard interfaces
-
Added foreign function interface via
define-foreign
syntax. -
Added support for unboxed parameters and results to
%inline-wasm
. -
Added
%wasm-import
form for use by the FFI. -
Added Guile's structured exception system. All errors raised in the Scheme prelude are now structured.
Toolchain
-
Added global lowering pass to more easily emit Scheme constants that are not Wasm constants.
-
Added support for symbols/keywords in secondary Wasm modules that import the ABI from a primary module.
-
Improved compiler tree shaker to reduce overall Wasm binary size.
-
Reduced the size of bytevector literals in Wasm binaries.
-
Fixed lowering of
stringview_iter.slice
instruction. -
Fixed flonum constants sometimes being treated as fixnums.
-
Fixed printing of mutable strings in both JS and Scheme reflection libraries.
-
Fixed
scm_from_char
inreflect.wasm
. -
Fixed
br_table
implementation in Wasm interpreter. -
Fixed mis-compilation of
rational?
andinteger?
primcalls. -
Fixed switch optimization for repeated symbol comparisons.
Browser compatibility
-
Google Chrome 119 was released about a month ago and comes with Wasm GC and tail calls enabled by default. Hoot binaries now work in Chrome without fiddling with any experimental settings!
-
Firefox 120 was released with Wasm GC enabled, but tail calls will not be enabled until December 19th when Firefox 121 is released. For the time being, Firefox users can either install a Nightly build or enable
javascript.options.wasm_tail_calls
inabout:config
on Firefox 120. -
Safari/WebKit is still unsupported.
Get Hoot 0.2.0!
Hoot is already available in GNU Guix:
$ guix pull
$ guix install guile-next guile-hoot
(Hoot currently requires a bleeding-edge version of Guile, hence
guile-next
above.)
Otherwise, Hoot can be built from source via our release tarball. See the Hoot landing page for a download link and GPG signature.
Documentation for Hoot 0.2.0, including build instructions, can be found here.
Check out our greatest hoots!
For a detailed walkthrough of using the new foreign function interface, check out our cool new blog post about building interactive web pages with Hoot!
Robin Templeton and David Thompson recently presented about Hoot at the SeaGL conference in Seattle, WA. The talk was livestreamed and you can catch the replay on YouTube!
For bug reports, pull requests, or just to follow along with development, check out the Hoot project on GitLab.
If you build something cool with Hoot, let us know on our community forum! (Use OCAPN2023 for the Invite Code when you join.)
The code in this release was brought to you by Andy Wingo, Robin Templeton, David Thompson, and Christine Lemmer-Webber. The lovely Hoot art is by tessa. Special thanks to the MetaMask folks for funding this work!
Happy hooting! 🦉