System programming in D (Was: The God Language)

Manu turkeyman at gmail.com
Thu Jan 5 13:03:32 PST 2012


>
> That is the case with overriding a non-virtual function - the compiler
> will compile it anyway, and most of the time it will work. That's what
> makes it so eeevil.


I saw today, or last night, someone suggesting a keyword to make
non-virtual override explicit, and error otherwise. Which actually sounded
like a really good idea to me, and also addresses this problem.
I think a combination of not-virtual-by-default, and an explicit
non-virtual override keyword would cover your concern, and also minimise
the use of virtual functions. Sounds perfect to me ;)
Overriding a non-virtual is actually very rare, and probably often
unintended... I really like the idea of a keyword to make this rare use
explicit.


> It seems to me the decision is that of sacrificing a real and common
>> problem
>> case with frequent and tangible evidence, for the feeling that the
>> language is
>> defined to do the 'right' thing?
>>
>
> The right thing should be the default.
>

But I fundamentally disagree your choice is 'right'.. This is obviously
subjective, so I don't think that's a fair assertion.
The problem was obviously not completely defined, and not addressed
entirely.. I think the proposal above sounds like a better solution all
round, it addresses everyones concerns, and adds a nice little safety bonus
for rare non-virtual overriding ;)
But as I've previously said, I understand this can't change now, I've let
it go :P
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120105/e64f8adc/attachment.html>


More information about the Digitalmars-d mailing list