static and protection

Hasan Aljudy hasan.aljudy at gmail.com
Thu Mar 2 07:20:29 PST 2006


Tony wrote:
> "Hasan Aljudy" <hasan.aljudy at gmail.com> wrote in message 
> news:du4ulf$1hpp$1 at digitaldaemon.com...
> 
>>Kyle Furlong wrote:
>>
>>>John C wrote:
>>>
>>>
>>>>It appears that protection attributes on static class methods don't get 
>>>>recognised. This compiles without errors:
>>>>
>>>>    module stuff;
>>>>
>>>>    class Visible {
>>>>        private static void hidden() {}
>>>>    }
>>>>
>>>>    -----8<-----
>>>>    module program;
>>>>
>>>>    import stuff;
>>>>
>>>>    void main() {
>>>>        Visible.hidden();
>>>>    }
>>>>
>>>>An error is issued if hidden() is at module level. I sometimes feel that 
>>>>classes are second-class citizens in D.
>>>>
>>>
>>>This protection stuff is rediculous, any modern OO language needs to 
>>>handle these things well.
>>
>>Yeah, and the implicit module friendship is rediculous too!!! The whole 
>>C++ friend concept is rediclous.
> 
> 
> This is an issue that has been raised at least once before:
> 
> http://www.digitalmars.com/d/archives/digitalmars/D/23420.html
> 
> I believe that anything which violates encapsulation should be explicit.
> 
> For this reason, if a friendship level/type of access is required then an 
> explicit friend qualifier should be introduced.
> 
> This should also serve to make the C++ crowd happier.
> 
> Tony
> Melbourne, Australia
> tonysZ-mailboxZ at hotmailZ.com  (remove the Zs)
> 
> 
> 

Yeah, that was me!
As you can see, I'm still whining about it :)



More information about the Digitalmars-d mailing list