Coding 2023-04-06
Before I get into messing with code, let's take a look at what I need to know for one of the future steps, that of getting rid of MapOverSelection. First, let's see how it's used.
- In artifact:
- I wrap it in an alias, which is, a bit unfortunate.
The alias is used only in the module, which helps.
The alias is used:
- In the signature of Artifact.convert. In this context, it is passed to _selection_labels, which corresponds to one of the metadata fields on a parametric, but I'm not sure which one currently, and to a Condenser and an OutputConverter.
- In the signature of Condenser.__call__. In this context, it is used directly, to alter a parametric through a folding operation. The probable updated version of this usage is to directly have a set of parametrics, and pass that directly to the fold.
- In the signature of InternalConverter.__call__. In this context, it is passed to the Input constructor.
- In the signature of OutputConverter.__call__. In this context, it is passed to InternalConverter.__call__ and the Input constructor, as well as to OutputConverter.__call__.
- Otherwise, it's held in the Input object, and passed out via Artifact.exposed_selections. Which is called from...
- I wrap it in an alias, which is, a bit unfortunate.
The alias is used only in the module, which helps.
The alias is used:
- The parametric_command module, specifically...
- Put.selections, which is accessed in...
- ParametricCommand._selections, which passes individual items to _update_labeled_maps, and also accesses a similarly-named attribute off of...
- AdaptiveParametric, which dynamically constructs a parametric based off of its attributes, in a very unsafe way, by the standards of this layer. The hope here is to replace this with bare Parametric, or a much lighter wrapper.
- _update_labeled_maps associates a selection label to a MapOverSelection, and this is helpful because...
- It is eventually passed to _optional_parametric? This confusing function only needs to pass it to Put.build, which passes it back to Artifact.convert.
From here, it looks like all I need to do is to make sure some of the types are properly restricted. I think that can be accomplished by...
Using the type Parametric[PathStr]. Or maybe pairs of Parametric[T] and Callable[[T], PathStr]. Which implies to me that maybe I don't rip out quite as much as I was thinking I would. However...
I forgot my train of thought.
Anyway, I think I've got the information I need to plan out new versions. The one wrinkle is, I want to figure out if it's possible to take the core parametric() logic from yesterday, and have some of it in common somehow, since, unless I manage not to need the pair stuff, the pair is going to need its own decorator with an extremely similar implementation.
In any case, I should get ready for bed now.
Good night.