Coding 2021-12-23
Just going to sum some things up quickly... Slightly bad/annoying news on the "wrapper types for dealing with Dynamic Output" front.
I added a new type into the mix, to handle Token targets that are added as extra_io. (Noting how they're added is mainly relevant because Token instances can't be passed on the command line.) This is a problem, among other reasons, because Token is one of the few classes that I specifically intend for other libraries to be free to subclass. That means I'm going to need to nail down exactly what the code needs to be able to do, and define that as an abstract function on the Token class.
So, let's review my previous sketches in light of the new reality. There may be multiple InputAccumulator[T] classes or there may not, doesn't matter. The new value of T that needs to be accounted for is Token. (The only subclass of Token currently is Deleted, which wraps a ... string? I don't remember why I wanted to use a string instead of pathlib.Path.) Either way, we need some way to define a function that accumulates information into a Token. My inclination is to have something similar to Input's map method. Make Token parametric on the wrapped type and put the type information in the method signature.
Here's another wrinkle... In my use case for this, the Deleted instances have to match up one-to-one with some paths generated elsewhere in the function...
So do I want this to go like:
- Fully generate the paths, extract the final Dynamic at some point, and map deleted over its contents, and re-flex the result?
- OR generate the data twice and keep it in sync with itself?
I'd been worried there was some reason I couldn't do the first option, but it looks like I was wrong. This is nice, because I means I don't actually have to do any of the stuff I was pondering earlier: I can do all of the hard stuff exactly once, then write a tiny trivial map function over Dynamic in order to convert the inner type.
It's getting late, so I can't stretch this out too much further, but I'll try to nail things down more tomorrow.
Good night.