Avoid Arg::id
ambiguity in derive by naming it for Type::field
instead of field
#4701
Open
2 tasks done
Labels
A-derive
Area: #[derive]` macro API
C-enhancement
Category: Raise on the bar on expectations
M-breaking-change
Meta: Implementing or merging this will introduce a breaking change.
S-waiting-on-decision
Status: Waiting on a go/no-go before implementing
Please complete the following tasks
Clap Version
4.1.0
Describe your use case
In clap v4, we switched the derive's implicit
Arg::id
to be the literal field name to avoid confusion over_
->-
. This can cause ambiguities across flattens, even if the longs are made unique.Describe the solution you'd like
What if we qualified these fields by their type?
The biggest problem for
Arg::id
is discoverability. For naive cases (no flattening), which is more obvious, an unqualified name or a qualified name? For non-naive cases, I think the user could understand the use of qualified names.Alternatives, if applicable
Do nothing.
Additional Context
#4699 has a related problem with variant structs in an
ArgGroup
. Since this is new design work, we've noted in #2621 to set theArg::id
according toVariant::field
which inspired this issue.The text was updated successfully, but these errors were encountered: