Date: Sun, 30 Nov 2025 23:44:05 +0200
On Sun, 30 Nov 2025 at 23:38, Ville Voutilainen
<ville.voutilainen_at_[hidden]> wrote:
>
> On Sun, 30 Nov 2025 at 23:15, Ville Voutilainen
> <ville.voutilainen_at_[hidden]> wrote:
> > > >> And you're missing the recursion in the next sentence:
> > > >>
> > > >> "If no declarations are found, the results of the unqualified search are the
> > > >> results of an unqualified search in the parent scope of S, if any, from P ."
> > > >>
> > > >> The scope S here is the global scope, which contains both A and the scope U
> > > >> in which the using-directive is active.
> > > >
> > > > I don't quite follow. When lookup in U is performed, I would expect
> > > > the using-directive to be active, instead
> > > > of having it active in the recursive step.
> > >
> > > Yes, the using-directive is active, but "each namespace contained by S"
> > > is not satisfied, because A is (only) contained by the global scope.
> >
> > Let me be clearer about what I mean. I expect searches for names in U
> > to find names in A, because
> > the using-directive is there.
> >
> > I don't expect that name lookup to fail to find names in A, and then
> > continue searching into the outer scopes,
> > and then perhaps managing to find names in A only after the searches
> > bubble up all the way to the global scope.
> >
> > The wording seems to suggest the thing I am not expecting.
>
> However, it seems that unqualified lookup has always worked this way,
> and has always had the requirement that names in namespaces
> that are targets of using-directives are found only when said
> namespace is contained by scope the lookup is performed in. Oh well.
..and having reconsidered the matter, that makes sense;
using-directives don't introduce names, but they don't hide
names either. Punting the lookup up to a scope that contains the
target namespaces makes that work. The alternative
I was having fantasies about would give latter using-directives the
ability to turn off earlier ones, and would therefore
give the latter using-directives the ability to hide the effects of
earlier using-directives.
No issue to be seen here, move along.
<ville.voutilainen_at_[hidden]> wrote:
>
> On Sun, 30 Nov 2025 at 23:15, Ville Voutilainen
> <ville.voutilainen_at_[hidden]> wrote:
> > > >> And you're missing the recursion in the next sentence:
> > > >>
> > > >> "If no declarations are found, the results of the unqualified search are the
> > > >> results of an unqualified search in the parent scope of S, if any, from P ."
> > > >>
> > > >> The scope S here is the global scope, which contains both A and the scope U
> > > >> in which the using-directive is active.
> > > >
> > > > I don't quite follow. When lookup in U is performed, I would expect
> > > > the using-directive to be active, instead
> > > > of having it active in the recursive step.
> > >
> > > Yes, the using-directive is active, but "each namespace contained by S"
> > > is not satisfied, because A is (only) contained by the global scope.
> >
> > Let me be clearer about what I mean. I expect searches for names in U
> > to find names in A, because
> > the using-directive is there.
> >
> > I don't expect that name lookup to fail to find names in A, and then
> > continue searching into the outer scopes,
> > and then perhaps managing to find names in A only after the searches
> > bubble up all the way to the global scope.
> >
> > The wording seems to suggest the thing I am not expecting.
>
> However, it seems that unqualified lookup has always worked this way,
> and has always had the requirement that names in namespaces
> that are targets of using-directives are found only when said
> namespace is contained by scope the lookup is performed in. Oh well.
..and having reconsidered the matter, that makes sense;
using-directives don't introduce names, but they don't hide
names either. Punting the lookup up to a scope that contains the
target namespaces makes that work. The alternative
I was having fantasies about would give latter using-directives the
ability to turn off earlier ones, and would therefore
give the latter using-directives the ability to hide the effects of
earlier using-directives.
No issue to be seen here, move along.
Received on 2025-11-30 21:44:20
