Module-level visibility

Nick Sabalausky a at a.a
Mon Feb 15 19:03:02 PST 2010


"bearophile" <bearophileHUGS at lycos.com> wrote in message 
news:hlcl4c$2ack$1 at digitalmars.com...
>I have shown this little program to some of my friends that program in 
>Java/C#:
>
> class Foo {
>    private int x;
> }
> void main() {
>    Foo f = new Foo;
>    f.x = 5;
> }
>
>
> When I say them this code compiles with D2 they usually tell me that the 
> compiler has a bug.

Interesting thing for them to say, considering that they don't actually know 
the language.

> So I suggest Walter to ask other people, maybe at Google or else (and in 
> this newsgroup too), if they think this feature of D2 is a good thing, 
> before this feature is set in stone in D2 (I have no definite answer about 
> this topic, I can't help you). If you are really sure this is a good 
> feature, then you can ignore this post.
>

I'd certainly feel more comfortable with private being current-class-only 
and having a new "module" access that works like private currently does. But 
I can live with it as it is.





More information about the Digitalmars-d mailing list