Replies: 1 comment
-
Your request does make sense; in fact it was implemented some time ago (see e.g. #279), with the keyword So, to answer your initial question, we do want to support this again in future versions. It just needs a bit more thinking around the implementation. The first step would be to open a proper issue to track this again. |
Beta Was this translation helpful? Give feedback.
-
I've had the idea of using nickel to manipulate existing configuration files for various other programs that are written in one of the supported formats for
nickel export
.The approach I was thinking of involves the use of the
import
feature.Unfortunately, the
default
priority is not inherited to all the children ofdefaults
so a merge will cause issues.Example:
Evaluating the above (using nickel version
nickel-lang-cli nickel 1.10.0 (rev cargore)
installed using cargo) errors out with a merge conflict:I understand why this error occurs. And I understand that there's a difference between having the priority of the field only applied to the field itself vs. having it recursively applied to all its descendants. Therefore, it would probably be unwise to change the behavior of the current priority syntax. Instead, a new syntax construct might be better suited for explicitly stating the wish to apply a given priority recursively to all children of a field that do not have their own priority metadata.
To adapt the first example from above to illustrate what I mean (notice the addition of the fictional metadata keyword
recursive_priority
):Is this form of priority inheritance a use case that future versions of nickel might want to support? My rust skills are insufficient to implement this myself but I figured it might be a useful addition to the language.
Or is there a way to manipulate the priority recursively by use of a function or a feature of the standard library? That might work, too, if priorities can be changed programmatically.
Beta Was this translation helpful? Give feedback.
All reactions