Crosscut

Daily Thought - 2025-03-08

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!

I've presented both record and variant types. I want to expand on those and how they interact, to hopefully make things a bit more clear.

Both records and variants are types, and they contain types. So naturally, you should be able to combine them freely. Here's a record that contains a variant and another record:

record {
    id: variant { Integer, Text },
    address: record { street: Text, house_number: Integer },
}

Here's a variant that could be either a record or another variant:

variant {
    record { street: Text, house_number: Integer },
    variant { Integer, Text },
}

And by the way, I've chosen the syntax here for clarity in these examples. It might or might not be similar to what eventually ends up in the language.

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.