Crosscut

Daily Thought - 2024-11-08

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.

< back to list

So, I need to track the arity of every expression at compile-time. And doing so is complicated, because of the eval intrinsic, which has an arity that depends on the anonymous function it evaluates. I came across this problem maybe a week or so ago (or was it 2, maybe 3? I can no longer tell 😂).

The core problem here is, that the eval call not only needs to work where the anonymous function is defined. You can also return the anonymous function from where it was created, and then evaluate it elsewhere. If all you do is track arity, you'll lose the information that you need to assign an arity to the eval call, leaving the system with holes.

So you need to track which of a function's return values is an anonymous function. But since anonymous functions can return other anonymous functions, it's also not enough to just track the arity of those. At this point, I think it becomes easier to forget about arity, properly define what a type is, and track which types every expression consumes and produces. That's a static type system.

<< previous thoughtnext thought >>

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.