Crosscut

Daily Thought - 2025-03-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!

Yesterday, I showed how records and variants can be combined. All the code I've shown there, were examples of anonymous usage. But as I've alluded to before, we can also assign names to types.

Id := variant { Integer, Text }
Address := record { street: Text, house_number: Integer }

record { id: Id, address: Address }

I'm using the := syntax here as a shorthand for "a name was assigned somehow" (for example via a module). Please don't take it too seriously.

Just assigning a name doesn't make a type nominally typed. It just creates a type alias (like type works in Rust). But named or not, any type I've mentioned today or yesterday would still be structurally typed.

While I believe that nominal typing is very valuable (and the language will support it), I'm convinced that structural typing is a better default. Explaining why I think that would go a bit too far right now, but I'm sure that will be the topic of many daily thoughts in the future.

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.