Conversation
|
Hm, what's the use case for this? Presumably you always do care about the type of an option since you need to use it somewhere eventually. |
|
@edolstra I don't think the |
|
Yeah exactly, the intention is for this type to replace |
Previously it would error out for a single function definition
This new type has unsurprising merge behavior: Only attribute sets are merged together (recursively), and only if they don't conflict. This is in contrast to the existing types: - types.attrs is problematic because later definitions completely override attributes of earlier definitions, and it doesn't support mkIf and co. - types.unspecified is very similar to types.attrs, but it has smart merging behavior that often doesn't make sense, and it doesn't support all types
b1a984d to
329f046
Compare
329f046 to
3106993
Compare
|
Changes since the last revision:
|
|
Thanks @infinisil ! |
Motivation for this change
This introduces the new type
types.anything, which implements a safe and reasonable merge strategy if you don't care about the type. Specifically:mkIf's and co. for all valuesThis is in contrast with the often-used
types.attrsandtypes.unspecified, which can be problematic because they don't adhere to above points. If both this PR and #97114 are merged, I can start deprecating those in favor of this one.Note that the doc entry for this new type is intentionally kept small, because its behavior is very natural and doesn't need a special explanation.
Ping @rycee @roberth @Profpatsch
Things done