private module declarations
Derek Parnell
derek at nomail.afraid.org
Sun Aug 6 20:10:55 PDT 2006
On Sun, 06 Aug 2006 21:19:35 -0300, 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.
Makes a lot of sense to me too.
What is fundamentally different about classes and structs, and every other
type of declaration when it comes to visibility/accessibility? I'm sure
this is a hang over from "the way C++ does it" mentality.
--
Derek
(skype: derek.j.parnell)
Melbourne, Australia
"Down with mediocrity!"
7/08/2006 1:08:40 PM
More information about the Digitalmars-d
mailing list