Caterpillar

Daily Thought - 2024-07-02

< back to list

Caterpillar is designed not to perform I/O directly. Instead, Caterpillar code is embedded into a host. If it needs something from the outside world, it can trigger an "effect". The host then handles that effect, performing the required I/O and returning the result to the Caterpillar code.

Right now, this is implemented in a very straight-forward manner. The host is a mix of JavaScript and Rust code, the Caterpillar code is run by an interpreter, and whenever that interpreted code needs something done that it can't do itself, it triggers an effect. The host then executes that effect and resumes the Caterpillar code.

If Caterpillar ever compiles to machine code, then it should be possible to optimize all of that away. Make the host (mostly?) disappear as something that generates runtime overhead. But even then, it will still exist on a conceptual level. Its presence will be felt in the source code, at least.

<< previous thoughtnext thought >>