Module-level accessibility

Denis Koroskin 2korden at gmail.com
Mon Oct 4 11:27:35 PDT 2010


On Mon, 04 Oct 2010 22:13:52 +0400, Jonathan M Davis <jmdavisProg at gmx.com>  
wrote:

> On Monday, October 04, 2010 10:37:53 Sean Kelly wrote:
>> Andrei Alexandrescu Wrote:
>> > There is still debate on the matter of private methods in interfaces.
>> > Please bring up in this forum any additional pro and con arguments  
>> that
>> > you might have.
>>
>> What debate?  Private methods don't get a vtbl entry so I don't see how  
>> an
>> interface could possibly require one, regardless of in-module  
>> visibility.
>
> Except that per TDPL private methods are _supposed_ to be in the vtable:
> http://d.puremagic.com/issues/show_bug.cgi?id=4542
>
> The fact that they don't currently is definitely limiting. Personally, I  
> liked
> what TDPL said about interfaces and private methods, and I don't know  
> what the
> debate against them is. It all seemed quite sensible to me.
>
> Regardless, however, private methods really should be properly  
> polymorphic.
>
> - Jonathan M Davis

I agree. Class A can access private methods of class B as long as both  
defined in the same module. If it has access to private methods, why can't  
it override them? Makes little sense, if you ask me, especially given that  
user may prevent overriding methods using "final" keyword. And the  
"package" also implying final is just ridiculous!


More information about the Digitalmars-d mailing list