C++ Logo

SG7

Advanced search

Subject: Re: Reason for members of namespace
From: Andrew Sutton (asutton.list_at_[hidden])
Date: 2020-11-04 08:25:21


>
> So far, we got 3/5, also attributes were re-proposed almost equally by
> someone else (maybe 4/5), so I'm happy that even though I couldn´t work
> with that and participate in last years 😞, some convergence emerged 😛!
>

Convergence is always a good sign :)

Back in the day I thought about a "is_first_redeclaration" predicate, I
> don't know if somebody else considered something like this, compilers
> probably maintain a pointer to previous declarations in redeclared AST
> Nodes, so it is probably cheap acquire this info, and even if you get
> out-of-order function declarations in different compilations units you
> still can get the same function name and parameter types, even in cases
> when parameter names are different;
>

That's not implementable in GCC without major surgery because it merges
declarations. There is no first and last declaration, only the most
recently seen. I don't believe it's the only compiler that works this way.

The approach described by P2237 is to only visit one declaration.

What is written in the proposal p1240r1.pdf
> <http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1240r1.pdf>
> page 36 puzzled me :
>
> "Of note here is that we are not proposing a function to retrieve
> members of namespaces: Due to their"open scope" nature, we believe that
> capability is somewhat meaningless. There is however no known technical
> reason preventing us from doing so."
>
> I interpreted "meaningless" in the sense of "not useful", by the previous
> answers I presume that "yes it has good uses" and also there are
> known technical issues.
>

I think at the time of writing, we didn't have any solid use cases in mind.

Andrew



SG7 list run by sg7-owner@lists.isocpp.org

Older Archives on Google Groups