Daily Thought - 2024-07-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.
I've mentioned linear types before, in the context of representing I/O resources as values. In a linear type system, values can be used exactly once. This would be an error:
value do_thing
value do_other_thing # error! already used `value`
So far, this is similar to Rust's type system, which uses affine types. With affine types, values can be used at most once, meaning they can also be used zero times. This is not possible with linear types:
make_value => value {
# error! not using `value`
}
Being forced to use every value, means that errors need to be handled, files need to be closed, etc. And this is enforced at compile-time, so you won't forget.
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.