Coding 2021-12-15
Okay, I'm still focused on MOTR, so I might as well think about it carefully. Right now, I'm concerned with synthesizing Builder[Input[PathStr]] objects. This can be more-or-less broken into several distinct parts:
- An initial Builder[Input[T]], where the type variable has some reasonable bounds.
- A Callable[[U, T], T] that builds up the wrapped value; T can unify with U, but this isn't required.
- For key of type Key[PVector[K]], a Callable[[K], U] to convert the values from the ItemRegistry into the proper form.
This should coalesce into a few specific objects:
- InputAccumulator[T, U] wraps a Builder[Input[T]] and a Callable[[U, T], T].
- ValueAdaptor[K, U] wraps a Key[PVector[K]] and a Callable[[K], U].
The InputAccumulator[T, U] has an evolution method that takes a ValueAdaptor[K, U]. Once all values are accumulated, the wrapped Builder[Input[T]] can be extracted and converted into a higher-level Builder via its flex method (name subject to change), and then that builder can be concatenated onto the main command.
Now, this doesn't all quite work, because I'm not sure that it makes sense for every InputAccumulator[T, U] in a given context to have the same U, so it's almost like, it should actually be a ValueAdaptor[K] with a Callable[[K, Type[U]], U], and InputAccumulator[T] has a Callable[[ValueAdaptor[Any], T], T].
Now, this is all pretty flexible-looking, but I think I want the possible types in play to be pretty heavily restricted. Like, how far can I get if T and U have to be either str or PathLike[str]?
I'll have to think for a while to see if that would somehow break something, but it seems solid right now.
Now, moving on from that for a moment, to consider how the ValueAdaptor[K]s show up. Now, the InputAccumulator[T] objects are ultimately used to create an Output[T] object, which sounds pretty bad, but honestly I've got bigger fish to fry for a while. The point is, accumulating these axes of output variation makes the most sense if there's associated input variation, otherwise it's just duplicating stuff for no reason. So, the ValueAdaptor[K] object needs to be part of some larger object that creates non-output variation in some way.
Basically, it just needs non-output Fragment or Option Builders.
I think the best course of action at this point is to wait a few days, and see if this all still makes sense. For now, I want to take things easy.
(Late addition: the InputAccumulator[T], being meant for output mode, should include some of the arguments to the flex method.)
Good night.