private module declarations
Bruno Medeiros
brunodomedeirosATgmail at SPAM.com
Tue Aug 8 11:01:25 PDT 2006
Tom wrote:
> I know this is not the first time this comes into the light but... I
> insist.
>
> Actually (luckily), one can do the following:
>
> bar.d
> | class Bar {...whatever...} // Aux object
>
> foo.d
> | private import bar; // Private could be omitted
> |
> | class Foo {...whatever...}
>
> main.d
> | import foo;
> |
> | void main()
> | {
> | Foo f = new Foo;
> | Bar b = new Bar; // Error, private imported in foo.d
> | ...
>
> What are the difficulties of implementing in the language the following?
>
> foo.d
> | private class Bar {...whatever...} // Aux object
> | class Foo {...whatever...}
>
> main.d
> | import foo;
> |
> | void main()
> | {
> | Foo f = new Foo;
> | Bar b = new Bar; // Error, private member of foo.d
> | ...
>
> I would love to see this someday.
>
> Regards,
> --
> Tom;
> "Some things have to be believed to be seen."
Vote++
And just to clarify, any kind of 'access' should be checked for
protection attributes, including (but not limited to) :
new Bar()
Bar b;
Bar.func() // fail even if func is accessible
class Barbee : Bar { }
template(T : Bar) { }
template(alias A : Bar) { }
alias Bar Baz;
It may take a while to implement them all, so they don't have to be
implemented all at once (and likely shouldn't), it's the first two or
three that are the most important.
--
Bruno Medeiros - MSc in CS/E student
http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
More information about the Digitalmars-d
mailing list