Caterpillar

Daily Thought - 2024-04-14

< back to list

For the last few day's, I've been talking about the platform concept that I'm stealing from Roc. I initially thought about platforms in terms of, CLI, desktop, servers, browsers; places where you can run your applications, that might look very different from each other. But I discovered that the platform concept is widely applicable, and can be used in more subtle ways.

Earlier on, I talked about compile-time execution of Caterpillar code. This is a very different environment, with different considerations. And it's not an easy thing to do, if your language wasn't designed for it! Using Rust as an example again, at some point it gained const fn. But that didn't just solve the problem. What you can or can't do in a const context has been a perpetual topic ever since, with every new release unlocking at least a few more standard library functions.

But what if your language can do nothing by default, and gets all its capabilities from an external platform? Then suddenly it's very easy. Because the compiler is just another platform, which can provide you with I/O primitives that are suitable for its context. Everything that can be powered by those I/O primitives just works. And everything else can still be made to work, as long as you manage to mock the required primitives.

<< previous thoughtnext thought >>