Coding 2024-07-10

By Max Woerner Chase

I'm not quite comfortable writing code yet, so let's take a look at the kinds of contracts I want to have.

The match function takes a Structure argument; this type is a union of many types. The straightforward stuff is:

The minor complicating factor is that I don't remember what I think matching pattern to pattern should do.

The major complicating factors are around, for one, "complex" types like tuples; there's a large amount of scaffolding around treating them in a sophisticated fashion, in the old code, and I can't jump into that. And the other is what I'm currently calling CompoundStructure. This is a marker/abstract class, and I can't see any way to express all of the expected behavior at the match function, where it's relying on polymorphism to get the behavior. Ultimately, these are kind of the same thing, it's just that I can't force builtin types to subclass from my marker.

With that in mind, it's possible to write contracts for the easy cases above, and to suppose that the hard cases should delegate to the custom class. Furthermore, those cases should probably have separate... cases...

I'm not sure whether Deal can handle the kind of type annotations I want to throw at it. I guess I'll just have to try it.

Anyway, it's late and I want to get ready for bed.

Good night.