Coding 2022-12-29

Tags:
By Max Woerner Chase

I got distracted, so this is late again. Let's have a look at some minor tweaks to parameters.

I want to remove some of the repetition of the module names in the class and function names. Now, that could also bleed out into renaming the alias, because it's currently a little Pokémon-speak-y. (Granted, that isn't stopping me in most places, so it's not a high priority.)

Let's have a look at the generate_parameters function, though. That takes a set of labels, a, let's call it constants for now, and optionally a set of parameters to augment. The result is an iterator over a set of updated parameters objects.

I don't think there's another meaningful way to iterate over parameters objects, so the current way the name works is

fine.

But I wonder if there's a more explicit way to describe what it does.

Like the point is, you pass in a set of labels to iterate over, the constants to draw the values from, and an existing set of selected variables...

In some sense the point of all of these data structures is that they represent selections out of multiple possible values. So, what if we had select.Label, select.Labels, select.Selections, select.SELECTIONS, and select.select? I'll let those ideas stand for now, and move on to other things for the moment.

On the registry/constants side of things, the big change I'd make would be to re-export Label to provide a module interface that's consistent with parameters/select/whatever.

Next up: whether to make any big changes to flex. I feel like it does need some changes, but I'm not sure what those changes look like. One thing of note is that it's not a run-time dependency of parametric, so it's free to draw in many other dependencies...

Let's ignore cmd, mkdir, facts, and io off the bat, because they're in more core positions. It's a bit much to go into the remainder of those, so let's focus on flex. The basic purpose of the flex classes is to interact with the parameters/variables/select systems to make sure that a given output file is specified once per command and is different for each set of selections used to generate a command, and that related inputs can be passed multiple times to a single command if desired. There are two main classes there, and a bunch of auxiliary classes. Let's see what's needed to instantiate these main classes:

This stuff is all kind of named after how it behaves in the context of multiple configurations. It's "flexible" because you can define a command-line argument once, and it will automatically adjust to the pool of parameters it's supposed to select from.

As such, this is a bad name, because what most people will care about is how it behaves in the context of a single configuration. In a single configuration, these classes need to be produced or obtained in various ways to pass into helper functions that create a Part for a parametric command.

I'm going to have to think about this. For now, it's late.

Good night.