Daily Thought - 2025-03-11
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!
The type system needs to support nominal typing, but I don't want to add a separate set of types just for that. I want a design that is simple, orthogonal, and composable, and that means there should be one construct to take any type (which are all structural by default) and make it nominal. Something like this:
Address := nominal record { street: Text, house_number: Integer }
That's it. Just add nominal
, and now Address
is a nominal type. Where your
code expects an Address
, another
record { street: Text, house_number: Integer }
will not be accepted. (Again,
the :=
syntax is just shorthand for "a name was assigned somehow".)
Please note that there's one interesting consequence arising from this design: Since making a type nominal and assigning a name to it are orthogonal concepts, it becomes possible to create types that are both nominal and anonymous. This seems nonsensical, but it's probably fine. As long as each element is simple and can be understood well, it's just a harmless quirk.
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.