Crosscut

Daily Thought - 2025-03-26

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!

There's an important topic related to structural typing that I haven't talked about so far: normalizing structural types. Let's consider a function that takes a record { a: A, b: B }. What if the user provides a record { b: B, a: A } to that function?

I think it should just work. Those two records should be considered the same type. Which means, before comparing them, the records need to be normalized, by sorting their fields. Probably alphabetically, by field name. But that might be an internal implementation detail.

And unless I'm missing something, that's all there is to say about normalizing record types. But normalization is a bit more interesting with variant types, so let's get into that tomorrow!

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.