Crosscut

Daily Thought - 2025-03-13

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!

It can make sense to make the fields of a nominally typed record private. (Let's ignore variants for now. That's a topic for another day.) I initially thought, that all nominal types should be private by default. I even considered (and that's still not off the table) to call the nominal keyword opaque because of that.

Making nominal/opaque have this double meaning would not be very orthogonal, but that might be a worthwhile trade-off. It would avoid having field visibility as a separate feature. Fields that should be accessible, can be made so by adding a function that makes them so. It would make the overall system much simpler.

Such a design would also set a tone. It could encourage safe abstractions, as opposed to APIs whose correct operation is the user's responsibility. I'm all for that, but I can also see how it could backfire. There is such a thing as too much abstraction. Then again, maybe I don't need to worry about that, if structural types and public fields are the much more accessible default.

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.