-
-
Notifications
You must be signed in to change notification settings - Fork 14.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce types.anything
#97119
Introduce types.anything
#97119
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:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.attrs
andtypes.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