Can you publicly alias a private type?
Peter Alexander
peter.alexander.au at gmail.com
Wed Jun 22 06:27:47 PDT 2011
On 22/06/11 2:19 PM, Nick Sabalausky wrote:
> In your example, the user needs to be able to use the Foo symbol in order to
> get full use out of Foos. However, in my example, the user does *not* need
> to use the Foo symbol in order to get full use out of Bar. They can just use
> Bar in place of Foo. The "Foo" symbol is a necessary part of Foos's
> interface, but it is *not* a necessary part Bar's interface.
They don't *need* the Foo symbol:
// module A
private class Foo;
public alias Foo[] Foos;
Foos getFoos();
// module B
import A;
void main()
{
Foos foos = getFoos();
foos[0].someFunc();
auto f = foos[0];
}
Here, module B hasn't used the Foo symbol, but it's as if Foo isn't
private at all. I don't know about you, but this feel really wrong to me.
More information about the Digitalmars-d
mailing list