Daily Thought - 2024-12-09
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.
The second reason that annotating functions with effects may be of limited use, is that it would be noisy. Let's look at division (the math operation) as an example. Dividing can trigger the "divide by zero" effect. Any function that divides, or calls a function (maybe transitively) that divides, could trigger the "divide by zero" effect.
For certain kinds of code, that effect would be everywhere. But annotating every function with it would be useless. It would just be noise that tells me nothing about how well I'm actually dealing with the error. A solution to that could be dependent types.
I'm not ready to fully dive into dependent types right now, but you can think of
them as types that include values. So instead of just saying n: Number
, you
could say n: Number and n != 0
. If you then divide x
by n
, you (and the
compiler) would know, that this can't trigger the "divide by zero" effect.
Sounds like that would make effects a lot more useful!
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.