cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.69k stars 748 forks source link

[basic.scope] What is type equivalence? #6491

Open Eisenwave opened 1 year ago

Eisenwave commented 1 year ago

[basic.scope] p3 refers to same types in one definition, and equivalent types in another.

When are two types considered equivalent, and what is the difference between that and them being the same type? There should be a forward-reference to the relevant section, and I was unable to find it.

Eisenwave commented 1 year ago

I think this might refer to [temp.over.link] p5, and what is really meant is that the expressions denoting the parameter types are equivalent.

Eisenwave commented 1 year ago

It's worth noting that the next paragraph already forward-references [temp.over.link], so adding another reference seems obviously correct.

JohelEGP commented 1 year ago

AFAIK, the convention is that, within a subclause, a reference to a term appears only once. So you might want to move the reference to the earliest appearance of the term within the subclause.

Eelis commented 1 year ago

Seems related to https://github.com/cplusplus/draft/issues/1475.

tkoeppe commented 11 months ago

@JohelEGP Where are you getting this convention from? I don't think this is an ISO rule, and I also don't recall us having such a general preference. I couldn't find anything in the wiki, either. Has this come up before?

JohelEGP commented 11 months ago

Nothing explicitly stated in any guideline, although I remember @jensmaurer calling it out before when someone repeats a reference. I'd have to find such a comment. But you can also see that subclauses typically don't repeat a reference twice.

jensmaurer commented 11 months ago

@tkoeppe In general, having the same cross-reference repeated in close proximity is something CWG has avoided in the past. I wouldn't go as far and say "one xref per subclause", but duplicating xrefs in a single paragraph certainly crosses the line. There's a judgment call for the grey area in between.

For "consecutive paragraphs structured the same", I'd say an xref for the first such paragraph is enough.

tkoeppe commented 11 months ago

I'd judge it by whether the cross reference is useful. If a subclause has 12 paragraphs and p1 and p12 refer to the same remote rule in different contexts, I'd consider whether a reference in both paragraphs is help for each one.