Can you publicly alias a private type?

Jonathan M Davis jmdavisProg at gmx.com
Tue Jun 21 08:47:20 PDT 2011


On 2011-06-21 07:14, Peter Alexander wrote:
> Is the following legal D?
> 
> // module A
> private class Foo;
> public alias Foo Bar;
> 
> // module B
> import A;
> Bar b; // I can't use Foo, but can I use Bar?
> 
> 
> I'm adding module level protection for types into DMD and wondering if
> this should be legal.

IIRC, there was a big debate about that a while back, but I don't remember the 
outcome. I would have thought that it would be illegal, but I don't know. 
Regardless, alias and access modifiers are broken anyway ( 
http://d.puremagic.com/issues/show_bug.cgi?id=6013 ). Also, these bugs seem to 
relate to the issue:

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

- Jonathan M Davis


More information about the Digitalmars-d mailing list