|
Boost : |
From: Gabriel Dos Reis (gdr_at_[hidden])
Date: 2004-02-14 16:16:22
David Abrahams <dave_at_[hidden]> writes:
| Gabriel Dos Reis <gdr_at_[hidden]> writes:
|
| > If you follow the first principle that scopes nest, then the "C" in
| > the altenrative #1 gets hidden by the member S<>::C in the local scope of
| > S<>::f()-body (current situation). If you want something different,
| > you'll end up with a notion similar to "parallel scopes" or
| > "injection of enclosing scope into the enclosed scopes" (which is
| > contrary to "scopes nest").
|
| You could just use the rule that each template parameter list forms
| a scope that encloses whatever it adorns.
Yes. And that is what we currently have and that leads to the member
name hides the enclosing template-parameter name rule.
There are two observations to make:
(1) in order to "minimize surprises", there is an additional rule
saying that it is not permitted to (directly) redeclare a
template-parameter name in the scope it adorns.
(2) the cases where there still are surprises (The case David
Vandevoorde posted) is when the member-name comes from a base
class. This case may be surprising to some because names in
base classes are not directly declared -- therefore point (1)
can't apply. Rather, they are found through lookup that proceeds
from inner-to-outer scope search.
I believe that the proposed rule about invalid template-parameter
renaming is a minimal damage to the general "scopes nest" principle.
| Then the reading that's obvious to me follows "from first principles".
That would work for member templates (assuming we change/clarify the
current rules) but it would not resolve the issue mentioned by David
Vandevoorde to his satisfaction.
-- Gaby
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk