[Issue 4533] Ban public aliases to private symbols

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jul 31 05:05:04 PDT 2010


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



--- Comment #4 from Sobirari Muhomori <dfj1esp02 at sneakemail.com> 2010-07-31 05:04:59 PDT ---
(In reply to comment #0)
> 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

> So the
> conclusion was to cut the problem in the nip and retain the primary idea of
> aliases as mere helper symbol references

This is how it works. It doesn't matter, whether the alias is public or not,
alias is still public, it doesn't help you access private members, as you can
access them directly:

module B;
import A;

void main() {
    A.foo();
}

I think, if you access only alias, in, say, some sort of metaprogramming, you
won't touch foo and your code will be valid.

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