Daily Thought - 2024-10-16
Hey, I'm Hanno! These are my daily thoughts on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!
This thought was published before Crosscut was called Crosscut! If it refers to "Caterpillar", that is the old name, just so you know.
The idea of having memory management strategies
that are not directly built into the language is not new.
malloc
is just a function after all. Rust has the Box
type, and
Rc
/Arc
. Zig adds another twist and requires an explicit allocator to
reserve memory on the heap.
As I've been working on this series of daily thoughts, I've realized what I want for Caterpillar is basically region-based memory-management. A region would be represented as a value in the language. Different types of regions could provide different memory management strategies. And they'd use the linear type system to make that sound, and as error-proof as they need to.
This also fits with the host concept. The core language would only know about the stack. Access to the heap is provided by the host. I assume there would be standardized interfaces, that region types written in Caterpillar could build on. But also host-specific region types. A host running on a desktop or server OS could provide different regions than one running on a microcontroller.
Hey, you! Want to subscribe to my daily thoughts? Just let me know (maybe include a nice message, if you're up for it), and I'll send you an email whenever I post a new one.