public aliases to private/package symbols
Nick Sabalausky
a at a.a
Tue Jan 24 20:46:04 PST 2012
"Timon Gehr" <timon.gehr at gmx.ch> wrote in message
news:jfnsne$10re$1 at digitalmars.com...
> On 01/25/2012 03:56 AM, Nick Sabalausky wrote:
>>
>> There's no need for special cases. Just don't go de-aliasing symbols.
>> That
>> takes care of everything.
>>
>
> It does not.
>
> private class A{
> static A factory();
> }
>
> public alias A B;
>
> What is typeof(B.factory()) ?
>
That's not a problem that's specific to alias. It's symptomatic of a more
general access issue (instances of private types exposed in a public
interface) that is *not* solved by prohibiting access-expanding aliases:
private class A{
static A factory();
}
public class B{
A foo() { return A.factory(); }
}
In another module:
typeof((new B()).foo()) // What should happen?
If "public alias A B" must be banned due to tough accessibility questions,
then so must "class B". Point is, it's not an issue specific to alias.
More information about the Digitalmars-d
mailing list