Crosscut

Daily Thought - 2025-04-11

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!

Error handling in Rust goes pretty far already in meeting my design goals. You can mostly ignore error handling by using unwrap or the combination of ? and something like Anyhow. Then you can come in later to tighten things up. But I see multiple problems.

If you go with the easy approach, you are limited at first in how you can handle errors. You could check if an error occurred, or catch a panic (well, sometimes). But you couldn't really handle the error, because the details are lost. So you need custom error enums, and there are tools to help. But it's still a lot of repetitive code to write.

More importantly, some of my design goals aren't met. If you do a quick-and-dirty prototype, it's not at all obvious which errors it could trigger, and where. Your main function either returns nothing, if you rely on panics, or something general like an anyhow::Result. To figure out the "which" and the "where", you need to audit your whole code base.

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.