Crosscut

Daily Thought - 2024-12-10

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 let's assume that in the future, the compiler annotates functions with the effects they could trigger. Let's also assume, we make that useful somehow, maybe with dependent types. I implied earlier, that there's more we can do with effects, so let's take a look at that today.

What I'm going to talk about here are "algebraic effects". What that basically means (according to my limited understanding), is that effects become a first-class concept in the language. Something that the developer can define and handle themselves. As opposed to all effects being built into the language, and handled only by the host.

Allowing that has some profound consequences. Remember, effects stop execution and turn over control to a handler (currently the host), which can then resume execution after doing whatever else, or not. This is a very powerful ability, that can be used to implement features like exceptions, async/await, and many other things, without any special support from the language.

Starting tomorrow, I'd like to dig into that further.

<< 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.