Some things to fix

Steven Schveighoffer schveiguy at yahoo.com
Thu Jul 30 09:28:40 PDT 2009


On Thu, 30 Jul 2009 12:17:53 -0400, Ary Borenszweig <ary at esperanto.org.ar>  
wrote:

> Steven Schveighoffer wrote:
>> On Thu, 30 Jul 2009 12:04:54 -0400, Ary Borenszweig  
>> <ary at esperanto.org.ar> wrote:
>>
>>> 1. private applied to structs, classes, etc., doesn't have any effect:  
>>> I can access them anyway.
>>> 2. modifiers that don't make sense should be disallowed.
>>>
>>> I think these are pretty serious bugs (specially the first one). Why  
>>> new features are added to D and these things are not getting fixed?
>>  1 is not a problem unless you are in the same file.  Any  
>> classes/functions compiled in the same module are considered to be part  
>> of the same module of code, and therefore have access to eachothers  
>> private data.  Try accessing same private fields from outside the  
>> module.
>
> That's exactly what I'm saying.
>
> ---
> module one;
>
> private struct Foo {}
> ---
> module two;
>
> import one;
>
> Foo foo;
> ---
>
> Compiles without errors.

Oh, I read private applied to struct/class *members* sorry...

I agree private classes/structs should work.  I'm sure there's a bugzilla  
for it already.

-Steve




More information about the Digitalmars-d mailing list