Daily Thought - 2024-07-26
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.
Closures are currently boxed (i.e. allocated on the heap), so they can be represented by a single value on the stack. I don't think there's much to do about that, while the language is still untyped. With a more sophisticated type system, it will be possible to have closures live on the stack, with no extra heap allocations necessary.
And there are other sharp edges. A closure is consumed (its heap allocation is
removed) when evaluated by something like if
. But nothing prevents you from
copying the value that represents the closure and try to use that again. Or make
up a completely new value that then might or might not refer to a closure.
Right now, there's not much point in trying to fix stuff like that, I think. Things will get better, as the language develops. It's a process.
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.