Crosscut

Daily Note - 2025-06-14

Hey, I'm Hanno! These are my daily notes on Crosscut, the programming language I'm creating. If you have any questions, comments, or feedback, please get in touch!

Let's talk about abstraction! It's often very useful to describe a set of functions that apply to some type which isn't mentioned explicitly, and then write code that uses this set of functions to deal with any type for which these functions are defined. This goes by many names. Interface, trait, type class, protocol, concept, behavior, and probably more.

I've talked about structural and nominal typing before. And how I intend for types to be anonymous and structural by default, with an easy way to assign a name and/or make them nominal. I wonder if the same can apply here.

Initially, I thought that this idea was a bit wild. Turns out though, there's prior art, and even in a mainstream language! TypeScript has object types that are both anonymous and structural. Meaning you can define which functions you expect to be available on a value, and if they are, it type-checks. No need to assign a name to that type, or to implement it explicitly.