www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16004] New: Properly document changes to protection attributes


          Issue ID: 16004
           Summary: Properly document changes to protection attributes
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dlang.org
          Assignee: nobody puremagic.com
          Reporter: mathias.lang sociomantic.com
                CC: code dawg.eu

Since 2.071, protection attributes is a misnomer, since it now participates in
symbol lookup.
`private` symbols won't conflict with same-named symbols in other modules for
example, however the specs (
http://dlang.org/spec/attribute.html#ProtectionAttribute ) currently says
otherwise. Hence this section is in need of a rename / overhaul.

For reference, two links where the new behaviour was discussed:
- DIP22 implementation: https://github.com/dlang/dmd/pull/5472
- Martin's comment in 15897: https://issues.dlang.org/show_bug.cgi?id=15897#c12

Name lookup is also not documented in the specs, and it might be worth making
visibility and lookup rules be in their own, dedicated section.

Leaving aside the current bugs, name lookup is now performed in two phases:
- First local declarations / member of the scope
- Then imports of that scope

Scopes are considered in the following order:
A) Local
B) Mixin templates
C) Base class
D) Enclosing scope (starting from step A)

Note: For the import part, there is an issue opened:

The underlying reason for this order is to forbid any local symbol hijacking
(imported symbol hijacking is still possible) if a module introduces a new

May 08 2016