Scheme 很有趣
Scheme Is a Hoot

原始链接: https://gracefulliberty.com/notes/scheme-is-a-hoot/

在这篇博文中,安娜·利伯蒂(Anna Liberty)分享了她使用 **Hoot** 将 Scheme(特别是 Guile)编译为 WebAssembly(WASM)的经验。尽管 Hoot 目前尚不稳定、报错信息晦涩且文档稀少,但利伯蒂认为,能够不依赖 Emscripten 就在网页上运行自定义 Scheme 代码,是一项重大的技术成就。 该项目需要克服巨大的学习曲线,利伯蒂起初在使代码兼容 Hoot 的特定环境时遇到了困难。通过手动导入和重构,她成功开发了一个能够在原生 Guile 和浏览器中无缝运行的跨平台代码库。此后,她发布了一个演示该设置的物理原型。 展望未来,利伯蒂对将 Scheme 与 Zig 结合的潜力表示兴奋,并指出她认为这种组合非常有前景。尽管她承认进一步的集成可能会很复杂,但她对 WASM 生态系统的探索仍是一个持续且有益的项目,这加深了她对 Scheme 编程语言的理解。

抱歉。
相关文章

原文
Scheme is a Hoot — Anna Liberty

2026-05-21 · 3 min · #computing

Lately I've been spending time learning Scheme and using it to implement the concepts I'm learning in my physics classes as time permits. One of the most exciting things I've been doing with this is getting my Scheme to compile to the Web thanks to Hoot.

One of the biggest challenges has been the fact that Hoot is unstable. It's currently at version 0.9.0. The documentation is decent, but it could be better. The error messages can be cryptic. But it's a massive accomplishment to see Scheme code running on the Web via WASM. It's even more incredible to know that it's running on a stack the team created themselves, not relying on Emscripten.

My initial understanding of Hoot was that it could compile any Guile program to the Web. I quickly learned that I was mistaken when my code wouldn't compile. I then ported my code to use the Hoot versions of all of the functions, causing my code to be unable to run independently from Hoot. I then realized that Hoot actually supported more of Guile than I thought. I just had to manually import a lot of the stuff I previously took for granted.

Now I have set up my code to run on native Guile and on WASM via Hoot, with tests automatically running in both to make sure everything's set up correctly for both environments. It's a bit of a pain, but it works now. Most of my code is agnostic to whether it's running with the system's Guile interpreter or if it's been compiled to WASM and being run in the browser. I think that's amazing.

Currently, most of the work I've done has been on the backend. Working on getting this whole setup to work at all has been a hassle. I've also been working on getting the more fundamental physics logic working, which is especially difficult as a someone new to Scheme. But I've been making progress, and I've published a small prototype on a new page on my website and have published the source code.

In the future I'm curious to see if it's reasonable to compile Zig + Scheme programs to the Web with Hoot. I'm starting to feel more and more that Zig + Scheme is the perfect combination and I want to do more experimentation in that direction. That may be too complicated! I don't know yet. There's a lot for me to learn in the WASM world, and that's a large part of the fun.

This has been an insightful exploration into the depths of Scheme. I can't wait to do even more.

联系我们 contact @ memedata.com