visibility vs. accessibility of protected symbols
Martin Nowak
dawg at dawgfoto.de
Mon Feb 13 16:33:42 PST 2012
On Tue, 14 Feb 2012 00:26:14 +0100, Jonathan M Davis <jmdavisProg at gmx.com>
wrote:
> On Tuesday, February 14, 2012 00:15:40 Martin Nowak wrote:
>> Can you elaborate on what issues you see with NVI. After all it's only
>> the
>> final public
>> method that needs to call the virtual private methods.
>
> As I explain in that bug report, NVI can be acheived with protected
> rather
> than private. So, we can do NVI now with private being non-virtual.
> However,
> if we make private virtual, then the compiler can no longer inline
> private
> functions in classes unless they're marked as final. That's a
> performance hit
> to pretty much every class ever written.
>
> Yes, the conscientious programmer will mark their classes' private
> functions
> final unless they intend to use them for NVI, but the _default_ is then
> inefficient for little to no gain. All you gain is the ability to do NVI
> with
> private instead of protected, and that is not even vaguely worth the
> performance hit to almost every D class ever IMHO.
>
> - Jonathan M Davis
OK, that was known and I agree with you. I even find the concept of
overriding private
functions flawed. I thought you had something in mind with overload
resolution.
More information about the Digitalmars-d
mailing list