[Issue 4533] New: Ban public aliases to private symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 29 13:59:14 PDT 2010


http://d.puremagic.com/issues/show_bug.cgi?id=4533

           Summary: Ban public aliases to private symbols
           Product: D
           Version: D1 & D2
          Platform: Other
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: tomeksowi at gmail.com


--- Comment #0 from Tomasz Sowiński <tomeksowi at gmail.com> 2010-07-29 13:59:12 PDT ---
This module compiles fine...:

module A;

private void foo();
public alias foo goo;

... but try to use goo...:

module B;
import A;

void main() {
    goo();
}

... and an error comes up:

Error: function A.foo is not accessible from B

We had a long discussion on digitalmars.D whether visibility-expanding aliases
should be functional or not. If they were allowed, in some cases (member
functions) the very presence of the alias could alter the generated code (think
of class invariants, exposing public members to exe/dll, etc). So the
conclusion was to cut the problem in the nip and retain the primary idea of
aliases as mere helper symbol references whose existence ought not to be
manifested in binary code.

In other words, an alias whose visibility > than aliased symbol should fail
already on the declaration spot.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list