[Issue 16004] New: Properly document changes to protection attributes

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun May 8 12:42:38 PDT 2016


https://issues.dlang.org/show_bug.cgi?id=16004

          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 at puremagic.com
          Reporter: mathias.lang at sociomantic.com
                CC: code at 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:
https://issues.dlang.org/show_bug.cgi?id=15966

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
symbol.

--


More information about the Digitalmars-d-bugs mailing list