dcreager.net

Rethinking the ‘enum’ and ‘struct’ modules

2022-07-18

I've had enum and struct primitive modules for the longest time, but I don't actually use them anywhere. So far, when I've needed sum or product types in other S₁ code, I've just implemented them directly via S₁ closures. I don't know if that will be sustainable, but it's worked well so far.

That makes me think that those modules aren't needed. Thinking through it more, I think the modules are conflating (or were meant to conflate) multiple concerns: how to define sum and product types, and how to have fine-grained control over the memory layout of those types. But as I've discovered, you don't need primitives for the former if you don't care about the latter. And the primitives that I've implemented so far don't actually provide control over the memory layout!

So I think I'm going to remove them.

..