Become a Spritely supporter today!

We're building the next generation of distributed web technology for secure collaboration and we need your help to fill up our health bar

$14,201 of $80,000 raised so far! Please support Spritely!

Guile Hoot v0.5.0 released!

Dave Thompson —

Hoot version 0.5.0

We are excited to announce the release of Guile Hoot v0.5.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!

Hoot 0.5.0, four months in the making, features a Scheme interpreter, a lightweight concurrency API, improved Guile compatibility, and many small improvements and bug fixes.

Before reading further, how about evaluating some Scheme code?

Read on for the full release notes.

Highlights

  • New Scheme interpreter in the (hoot eval) module. Finally, it is possible to eval Scheme code at runtime! See the manual for an example program that uses the interpreter. Note that this initial version of the Scheme interpreter supports base Scheme syntax only and does not support user-defined macros. This restriction will be relaxed in the future when Hoot ships a full-featured macro expander.

  • New lightweight concurrency API based on Guile's fibers library. Fibers build atop JavaScript's promises and Guile's delimited continuations for convenient asynchronous programming without having to pepper your code with async/await. See the manual for documentation of the fibers API.

  • More of Guile's default environment (the (guile) module) has been implemented, and Guile-flavored define-module libraries now properly handle duplicate definitions. A few modules from upstream Guile can now be compiled into Hoot programs, such as (ice-9 vlist). Much work remains to be done, but 0.5.0 is a vast improvement over prior releases in this regard.

  • Uncaught exceptions now print backtraces with source locations! This one has been a long time coming and we're happy to finally say we have backtraces. Debugging was getting pretty painful without them!

New features

  • Added Scheme interpreter in (hoot eval) module.

  • Added fibers (lightweight concurrency) API in (fibers ...) module namespace.

  • Added support for R7RS define-library syntax.

  • Added code-ref Wasm heap type for storing source locations.

  • Added source locations to exceptions.

  • Added backtrace printing for uncaught exceptions.

  • Added (hoot interaction-environment) module.

  • Added (hoot regexps) module.

  • Added (hoot syntax-objects) module.

  • Added (hoot tree-il) module.

  • Added (ice-9 atomic) module.

  • Added (ice-9 binary-ports) module.

  • Added (ice-9 custom-ports) module.

  • Added (ice-9 control) module.

  • Added (ice-9 exceptions) module.

  • Added (ice-9 i18n) stub module.

  • Added (ice-9 match) module.

  • Added (ice-9 optargs) stub module.

  • Added (ice-9 ports internal) module.

  • Added (ice-9 rdelim) module, though it is mostly stubs.

  • Added (ice-9 regex) module.

  • Added (rnrs bytevectors gnu) module.

  • Added (srfi srfi-9 gnu) module.

  • Added (srfi srfi-11) module.

  • Added #:unwind-for-type support to with-exception-handler.

  • Added fluid? predicate to (hoot fluids).

  • Added endianness, native-endianness, string->utf8, utf8->string, and big endian support to (rnrs bytevectors).

  • Reimplemented hashtables and added support for eqv, equal, and custom hashtables.

  • Added partial compatibility for Guile's legacy hashtable API (hashq-ref and friends) to (guile).

  • Added numerous miscellaneous procedures to (guile) module for improved Guile compatibility.

  • Added duplicate definition resolution to define-module style modules.

  • Added define-external-type macro to (hoot ffi).

  • Added support for (ref null string) result type in define-foreign.

  • Added --run flag to guild compile-wasm for quickly testing compiled programs.

  • Added --async flag to guild compile-wasm to run async programs in conjunction with --run.

  • Reorganized JS reflection code and slightly changed the API. See the manual for updated web setup instructions.

  • Added call_async method to Procedure class in JS reflection API. Use this method to invoke async procedures that use fibers.

  • Added ,hoot-compile, ,hoot-compile-file, ,hoot-run, and ,hoot-run-file REPL commands. Enter ,use (hoot repl) at the Guile REPL to use them.

Bug fixes

  • Fixed Wasm invalid cast error when applying a non-procedure. A Scheme exception is now raised.

  • Fluids can now be used at expansion time.

  • Current port parameters (current-output-port, current-input-port, current-error-port) can now be used at expansion time.

  • make-bytevector and bytevector-copy can now be used at expansion time.

  • string->list can now be used at expansion time.

  • Fixed string conversion when going across the Guile/Wasm boundary when running Hoot programs on the Hoot VM.

  • Exceptions are now thrown when trying to open files when running in a web browser.

  • Fixed emitted code for lsh/immediate CPS instruction when y >= 33.

  • Fixed multi-byte character reads from input ports.

  • Fixed beyond-relooper compiler pass for convergent case-lambda.

  • Fixed stringref to wtf8 lowering for nullable strings.

  • Fix characters being quoted when printed with display.

Browser compatibility

  • Compatible with Firefox 121 or later.

  • Compatible with Google Chrome 119 or later.

  • Safari/WebKit is currently unsupported. The recent Safari Technology Preview has enabled Wasm GC and tail calls, but it seems there is still something missing.

Get Hoot 0.5.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 homepage for a download link and GPG signature.

Documentation for Hoot 0.5.0, including build instructions, can be found here.

Hoot at the ICFP Scheme workshop

Tomorrow, 9/7, lead Hoot engineer Andy Wingo of Igalia will be giving the opening keynote presentation at the Scheme workshop colocated with ICFP in Milan, Italy. Andy will be talking all about how we've made the dreams of the 90's come to life by bringing Scheme to the web. You can watch the talk live or later on the ACM SIGPLAN YouTube channel.

Get in touch!

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!

Thanks to tessa for the lovely Hoot art, and a special thanks to the MetaMask folks for funding this work!

Until next time, happy hooting! 🦉