[Version 10.0] Feature support for file-scoped namespaces#1540
[Version 10.0] Feature support for file-scoped namespaces#1540RexJaeschke wants to merge 4 commits into
Conversation
| - The scope of a name defined by an *extern_alias_directive* ([§14.4](namespaces.md#144-extern-alias-directives)) extends over the *using_directive*s, *global_attributes*, and *compilation_unit_body* of its immediately containing *compilation_unit* or *namespace_body*. An *extern_alias_directive* does not contribute any new members to the underlying declaration space. In other words, an *extern_alias_directive* is not transitive, but, rather, affects only the *compilation_unit*, *namespace_body*, and *file_scoped_namespace_declaration* in which it occurs. | ||
| - The scope of a name defined or imported by a *using_directive* ([§14.5](namespaces.md#145-using-directives)) extends over the *global_attributes* and *compilation_unit_body* of the *compilation_unit* or *namespace_body* in which the *using_directive* occurs. A *using_directive* may make zero or more namespace or type names available within a particular *compilation_unit*, *namespace_body*, and *file_scoped_namespace_declaration* but does not contribute any new members to the underlying declaration space. In other words, a *using_directive* is not transitive but rather affects only the *compilation_unit*, *namespace_body*, and *file_scoped_namespace_declaration* in which it occurs. |
There was a problem hiding this comment.
I expect that eventually there will be a conflict generated by these bullet items. These edits are built on top of the edits for the V9 feature "Top-Level Statements" (see PR #1454). And just an hour ago, I tweaked that PR to include "statement_lists" in two places in these items. Ultimately, this PR will need to remove those bits of text as their inclusion is subsumed by this PR.
| ``` | ||
|
|
||
| The scope of an *extern_alias_directive* extends over the *using_directive*s, *global_attributes* and *namespace_member_declaration*s of its immediately containing *compilation_unit* or *namespace_body*. | ||
| The scope of an *extern_alias_directive* is described in [§7.7.1]( basic-concepts.md#771-general). |
There was a problem hiding this comment.
Here, I invoked the spec-writing rule, "Don't say the same thing in two different places!"
| A *using_static_directive* ([§14.5.4](namespaces.md#1454-using-static-directives)) imports the nested types and static members of a type. | ||
|
|
||
| The scope of a *using_directive* extends over the *namespace_member_declarations* of its immediately containing compilation unit or namespace body. The scope of a *using_directive* specifically does not include its peer *using_directive*s. Thus, peer *using_directive*s do not affect each other, and the order in which they are written is insignificant. In contrast, the scope of an *extern_alias_directive* includes the *using_directive*s defined in the same compilation unit or namespace body. | ||
| The scope of a *using_directive* is described in [§7.7.1]( basic-concepts.md#771-general). |
There was a problem hiding this comment.
Here, I invoked the spec-writing rule, "Don't say the same thing in two different places!"
59ede4c to
16264b8
Compare
16264b8 to
213d033
Compare
213d033 to
47f222d
Compare
47f222d to
0c95845
Compare
|
An earlier version of this feature is already present on |
A few places that referenced namespace declarations didn't include the grammar production for *file_scoped_namespace_declaration* as well as *namespace_body*.
0c95845 to
9174098
Compare
This is Rex's adaptation of the corresponding MS proposal.
This feature allows
as an abbreviation for
As we now have two ways to declare a namespace, different compilation units can use different ways of declaring the same namespace, and we have to make sure the spec allows this. I've attempted to do that, but please read my edits carefully.
Also, I have introduced the grammar rule compilation_unit_body and I have attempted to use it instead of older text, but it's possible it could be used in more cases to make things simpler.