Coding 2023-04-19

Tags:
By Max Woerner Chase

Okay, here we go.

I want to create a placeholder value for installer labels to allow me to convert a bunch of a function I've written into a combination of a utility function and some static data, so I can define different data in other contexts.

Here is a first shot...

@attrs.frozen
class Placeholder(Generic[_installer.TArgs]):

    uninstantiable: NoReturn

    def resolve(self, __environment: object, __cmd: object) -> Facts[Input[Path]]:
        raise NotImplementedError

    def combine(
        self, __other: Placeholder[_installer.TArgs]
    ) -> Placeholder[_installer.TArgs]:
        raise NotImplementedError

The basic idea is that there's some way to take a ParametricCommandMeta[TEntry, TProgram, Placeholder[_installer.TArgs]], pass it a ParametricCommand[Module, Any, _installer.TArgs], and synthesize them into a ParametricCommand[TEntry, TProgram, _installer.TArgs].

I'm pretty sure I can write the code to do that, no big deal. I'm just not sure if it's a generally valid transformation, outside of the context where I want it.

All the same, it seems like a better idea to just go for it.

Now, how to lay this out. I'm leaning towards, actual definition in parametric_command, but re-export in the installers namespace. Some amount of support code to handle the type twiddles will probably be necessary, but I'm going to make a bold prediction that it won't be a big deal.

I'll get started on this tomorrow, because right now, I need to wind down.

Good night.