Daily Thought - 2025-04-15
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!
I was going to rule out exceptions as an option for error handling, but I'm no longer sure. Before we get into that though, let's look at how I thought that variant types and automatic lifting could address my design goals. And then, later on, why that probably won't work.
In this model, every function that can trigger an error returns a variant, with cases for its main return value and the error. But without early returns like in Rust (they don't interact well with linear types, for the same reason that effects or exceptions don't), you'd have to carry the errors through to the end of the function.
But then you'd have to deal explicitly with those variants after every function
call that returns them. This could end up rather verbose, unless you invent
special syntax (like do
notation). And this is where
automatic lifting comes in. It would allow you to just write code for the ideal
case, while automatically carrying errors to the function's exit point.
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.