-
Notifications
You must be signed in to change notification settings - Fork 5
Rethink Documentation Links to Parameters and Return types #754
Description
We don't have a special tag to reference parameters, we re-use the same @link and @see tags you use to link to everything else. This seems like it was originally an intentional design, with the idea that the code-gen could decide whether to use paramref or <c> depending on context.
Somewhere along the way we forgot this, or changed our minds on the behavior without properly re-implementing.
On this issue, I confidently declare that:
"Parameters ... can't validly be referenced by any Slice definition, and we don't allow linking to them in doc comments."
But I can't find a single point in the repo where linking to parameters is disallowed.
We also allow you to link to named return-type elements with @link and @see as well. It's not clear if this was intentional or just a bug. The code-gen has never handled this correctly.
Proposal
I propose we disallow pointing @link and @see tags at parameters (and return members).
In it's place, we should add a new @paramref tag.
This tag works exactly like @link, except it's:
- Only allowed on operations
- Can only link to a parameter of the operation you're documenting
For example:@returns this returns @paramref input + 2
Alternatively, we could fix the code-gen to match the "original vision" of @link and @see working for everything,
but I don't think we should.
- Many languages don't treat parameters as linkable types (C# and Rust certainly don't). So, there's no practical value.
- It would add complexity to the code-generation.