Daily Thought - 2025-03-30
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 think we're nearing the end of this series on the type system. (And after more than a month, it's about time.) I have two more items that I want to talk about. So today, let's get into what is probably the penultimate topic in this series: the unit type.
A unit type is a type that represents "nothing". A function that takes no
argument, or returns no result. Currently, this exists in the language in the
form of the value nothing
, which is of type Nothing
. But we actually don't
need a special type for that! Because that same role can be filled by the empty
record, record {}
.
And by the way, this is another reason not to have tuples. Because the empty tuple could be used as the unit type just as well. And then we'd have to decide if there are two unit types, which one is preferred, or if they normalize to the same type somehow. Much better to avoid this mess.
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.