Re: Can you publicly alias a private type?

2011-06-22 Thread Nick Sabalausky
"Peter Alexander" wrote in message news:itsqov$1mnt$1...@digitalmars.com... > 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

Re: Can you publicly alias a private type?

2011-06-22 Thread Peter Alexander
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

Re: Can you publicly alias a private type?

2011-06-22 Thread so
On Wed, 22 Jun 2011 14:52:52 +0300, Peter Alexander wrote: // module A private class Foo; public alias Foo[] Foos; // module B void main() { Foos fs; // Legal? Seems so. Foo f = fs[0]; // Clearly can't use Foo here, it's private. auto f2 = fs[0]; // Legal? fs[0].memFun();

Re: Can you publicly alias a private type?

2011-06-22 Thread Nick Sabalausky
"Peter Alexander" wrote in message news:itsp16$1jl5$1...@digitalmars.com... > On 22/06/11 1:41 PM, Nick Sabalausky wrote: >> "Peter Alexander" wrote in message >> news:itsl71$1cnq$1...@digitalmars.com... >>> On 21/06/11 7:59 PM, Nick Sabalausky wrote: "Peter Alexander" wrote in message >>

Re: Can you publicly alias a private type?

2011-06-22 Thread Peter Alexander
On 22/06/11 1:41 PM, Nick Sabalausky wrote: "Peter Alexander" wrote in message news:itsl71$1cnq$1...@digitalmars.com... On 21/06/11 7:59 PM, Nick Sabalausky wrote: "Peter Alexander" wrote in message news:itq945$2ag0$1...@digitalmars.com... Is the following legal D? // module A private clas

Re: Can you publicly alias a private type?

2011-06-22 Thread Nick Sabalausky
"Peter Alexander" wrote in message news:itsl71$1cnq$1...@digitalmars.com... > On 21/06/11 7:59 PM, Nick Sabalausky wrote: >> "Peter Alexander" wrote in message >> news:itq945$2ag0$1...@digitalmars.com... >>> Is the following legal D? >>> >>> // module A >>> private class Foo; >>> public alias Fo

Re: Can you publicly alias a private type?

2011-06-22 Thread Peter Alexander
On 21/06/11 7:59 PM, Nick Sabalausky wrote: "Peter Alexander" wrote in message news:itq945$2ag0$1...@digitalmars.com... 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

Re: Can you publicly alias a private type?

2011-06-21 Thread Nick Sabalausky
"Trass3r" wrote in message news:op.vxf267mf3ncmek@enigma... > Or more precisely to disallow instantiation by the user and only provide a > finite set of (nicer) methods. Yea. I did something similar in an early draft of the "Dynamic Fallback" example in my contest article ( http://www.semitwis

Re: Can you publicly alias a private type?

2011-06-21 Thread Trass3r
Or more precisely to disallow instantiation by the user and only provide a finite set of (nicer) methods.

Re: Can you publicly alias a private type?

2011-06-21 Thread Trass3r
Using a templated alias to provide a cleaner public interface to a private implementation that has a more complex interface). Yep, I also used this feature to restrict instantiations for a template function to a known finite set: private void foo(alias func)() { ... func(); ...

Re: Can you publicly alias a private type?

2011-06-21 Thread Nick Sabalausky
"Peter Alexander" wrote in message news:itq945$2ag0$1...@digitalmars.com... > 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

Re: Can you publicly alias a private type?

2011-06-21 Thread Jonathan M Davis
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 sh

Can you publicly alias a private type?

2011-06-21 Thread Peter Alexander
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.