Skip to content
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

Avoid Arg::id ambiguity in derive by naming it for Type::field instead of field #4701

Open
2 tasks done
epage opened this issue Feb 10, 2023 · 0 comments
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

Comments

@epage
Copy link
Member

epage commented Feb 10, 2023

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 the Arg::id according to Variant::field which inspired this issue.

@epage epage added 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 A-derive Area: #[derive]` macro API labels Feb 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

1 participant