Module-level accessibility

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Oct 4 12:14:09 PDT 2010


On 10/4/10 13:27 CDT, Denis Koroskin wrote:
> 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!

This is a very good argument that in my mind settles the case.

Andrei


More information about the Digitalmars-d mailing list