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

"single search" is confusingly ambiguous #4629

Open
RealLitb opened this issue Jun 4, 2021 · 9 comments
Open

"single search" is confusingly ambiguous #4629

RealLitb opened this issue Jun 4, 2021 · 9 comments

Comments

@RealLitb
Copy link

RealLitb commented Jun 4, 2021

I was reading the name lookup rewrite and initially was confused by reading that "a search" was defined to be something different than "a single search", until I found out that "single search" has its own definition, rather than being one quantity of search.

I recommend a different term. For class members, we have "direct member" and "member" (which includes inherited members). Similarly, "direct search" can be defined to only operate on the class's own scope, whereas a "search" will not.

This will also help to reduce ambiguities, when text wants to refer to one quantity of searches (maybe among multiple searches from different program points) as a "single search".

@jensmaurer jensmaurer added the decision-required A decision of the editorial group (or the Project Editor) is required. label Jun 4, 2021
@jensmaurer
Copy link
Member

@opensdh, any thoughts here?

@opensdh
Copy link
Contributor

opensdh commented Jun 4, 2021

I’m the one who suggested filing the issue, but I don’t have much of an opinion: whether enough people are confused by it to make it worth changing is an empirical matter. Nor am I sure about “direct search”, since “direct” sounds a bit like an intensifier rather than a restriction, although the parallel with members could be helpful.

@xmh0511
Copy link
Contributor

xmh0511 commented Jun 9, 2021

The meaning of the phrase "single search" might be read out from the following rule:

A search in a scope X for a name N from a program point P is a single search in X for N from P unless X is the scope of a class or class template T, in which case the following steps define the result of the search.

In my opinion, the purpose of defining "single search" is almost used to state how to search the namespace's scope, which is different from the scope of a class, the latter should undergo a search in its base classes if the declarations are not yet found.

@opensdh
Copy link
Contributor

opensdh commented Jun 9, 2021

Well, in truth it's unambiguous that [basic.lookup.general]/3 defines "single search" (per the index and everything). The question is not what defines it, but how to clarify this situation.

@xmh0511
Copy link
Contributor

xmh0511 commented Jun 9, 2021

Well, in truth it's unambiguous that [basic.lookup.general]/3 defines "single search" (per the index and everything). The question is not what defines it, but how to clarify this situation.

I also think we should clarify what the t and F are in this bullet.

If N is a non-dependent conversion-function-id, conversion function templates that are members of T are considered. For each such template F, the lookup set S(t,T) is constructed, considering a function template declaration to have the name t only if it corresponds to a declaration of F ([basic.scope.scope]). The members of the declaration set of each such lookup set, which shall not be an invalid set, are included in the result.

Frankly, I am not understanding this bullet. Does it try to construct a hypothetical name t in order to make S(t,T) work here? But, what's the characteristic of the template F here? In the initial, the bullet says "For each such template F", which are members of T, For this sentence "considering a function template declaration...only if it corresponds to a declaration of F" Isn't it the declaration of F does correspond to it by itself? I don't know what's the meaning here. it seems a bit obscure.

@opensdh
Copy link
Contributor

opensdh commented Jun 9, 2021

This bit about [class.member.lookup]/7 seems like a very separate issue. Yes, t is a hypothetical name; F is clearly one of the conversion function templates being considered. F certainly corresponds to itself, but other function templates (in other base classes) might do so as well.

@xmh0511
Copy link
Contributor

xmh0511 commented Jun 9, 2021

This bit about [class.member.lookup]/7 seems like a very separate issue. Yes, t is a hypothetical name; F is clearly one of the conversion function templates being considered. F certainly corresponds to itself, but other function templates (in other base classes) might do so as well.

The bullet says conversion function templates that are members of T are considered." and [class.derived#general-2] says

Members of a base class are also members of the derived class.

That means the set of this consideration only contains "conversion function templates" from T and its base classes and of one of them. We get two pieces of information here, the set only contains "conversion function templates" and they are all from T or its base classes. Every template F in this set certainly does correspond to itself, so, I don't know what's the necessity of this condition here.

@RealLitb
Copy link
Author

RealLitb commented Jun 9, 2021

Folks, can you please discuss that in a separate issue, the reflector or std-discussion. I feel like this is absolutely the wrong place.

@jensmaurer jensmaurer removed the decision-required A decision of the editorial group (or the Project Editor) is required. label Jun 12, 2023
@tkoeppe
Copy link
Contributor

tkoeppe commented Jun 12, 2023

Sorry about the derailment! We definitely appreciate the issue, and welcome a concrete rewording suggestion! Maybe we can find new terms for the current "search" and "single search" that are not overlapping in this confusing way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants