Some task authors have expressed a desire for this.options() to (recursively) deep merge task options. Right now, options are shallow merged (one level deep).
(Currently, target-level config options override task-level config options, which override built-in task options. Nobody is asking for this to change, yay)
Why aren't options deep merged? Because options are atomic. While individual options must be merged into a single object, their values should be left unchanged.
To better understand this, we must understand what an option is. An option is a single value used to configure a task. Tasks can be configured with zero or more options. Thus, the merged options object may contain, as its properties, zero or more options, each with a corresponding value.
When one thinks about options in this way, the idea of deep merging all options seems a bit heavy handed. So I'll propose an alternative, although I'm not sure what it should look like yet.
What if task authors could specify, inside the task where they specify the built-in default values, a per-option setting that enables deep merging for that option? The setting could be a number representing the max depth. And it would default to 0 or false for a shallow merge.
Thoughts?
Some task authors have expressed a desire for
this.options()to (recursively) deep merge task options. Right now, options are shallow merged (one level deep).(Currently, target-level config options override task-level config options, which override built-in task options. Nobody is asking for this to change, yay)
Why aren't options deep merged? Because options are atomic. While individual options must be merged into a single object, their values should be left unchanged.
To better understand this, we must understand what an option is. An option is a single value used to configure a task. Tasks can be configured with zero or more options. Thus, the merged options object may contain, as its properties, zero or more options, each with a corresponding value.
When one thinks about options in this way, the idea of deep merging all options seems a bit heavy handed. So I'll propose an alternative, although I'm not sure what it should look like yet.
What if task authors could specify, inside the task where they specify the built-in default values, a per-option setting that enables deep merging for that option? The setting could be a number representing the max depth. And it would default to
0orfalsefor a shallow merge.Thoughts?