Coding 2023-03-30

Tags:
By Max Woerner Chase

All right. Starting this entry early, because I've been considering some fiddly changes I want to make within MOTR.

Basically...

The problem with updating the cmd module is that the current release of MOTR is operating at such a low level (relatively speaking, do not scoff) that the motrfiles that I'm currently writing need to reach into MOTR's guts in order to actually accomplish anything. So, even though I have some ideas about changes I want to make (I'll explain those ideas in a moment), I need to make sure that I leave some way for the existing code to manage to accomplish stuff.

So, here's the issue. As the reproduction code I pasted yesterday kind of indicates, I'm doing some stuff where I'm basically replacing T with T | tuple[T, ...]. The problem with this type is that Mypy only allows me to accomplish anything with it, by, um, cheating. The proper replacement is something like NewWrapper[T] | tuple[T, ...] or NewWrapper[T] | OtherNewWrapper[T].

But if I do that, then the core code isn't supposed to handle T any more, which means that existing callers get broken.

So here's the trick: I only need to continue to support the old flow with the cmd module. Everything else is basically invisible to the motrfiles. SO.

I have EnvVar = Unique[T] | Paths[T], StrMap = Mapping[str, T], EnvVars = StrMap[EnvVar[T]], LegacyEnvVars = StrMap[T] | EnvVars[T]. Something like that. What this lets me do is to beef up support for EnvVars until I can cut the internal consumers over to it, but leave the legacy code paths in place until after I finally cut a release.

I probably need to finagle this a bit to account for the fact that I'm specifying concrete types in a few places, but this shouldn't be hard to iron out.

Regardless, I don't feel like I'm going to get it done tonight; I'm just glad I ironed things out a bit in thinking about the way I want the types to be interacting.

That said, I do have the option to make everything a bit less... precise, in exchange for having fewer types kicking around. This will need a bit of sketching to check, and right now I just want to take things easy for the rest of tonight again.

Good night.