Crosscut

Daily Thought - 2025-02-18

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!

Yesterday, I talked about boring expressions that turn nothing into nothing. Let's look at a more interesting one today:

127

This is an integer literal. In Crosscut (at least the current iteration), literals are just functions. In this case, a function that happens to take nothing as input and return 127 as output. Right now, there's only one type of integer (signed, 32-bit). But that's going to change as the language develops.

Here's another expression:

127 255

Again we start with nothing, which the application of the function 127 transforms into the value 127. That value is different from nothing, which is what 255 (like all integer literals) expects. This results in an error.

This approach is different from earlier prototypes that also used postfix syntax, but with a stack-based evaluation model. There, the same code would have resulted in a stack with two values on it.

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 every time I post a new one.