System programming in D (Was: The God Language)

Manu turkeyman at gmail.com
Thu Jan 5 18:06:32 PST 2012


>
>    The right thing should be the default.
>> But I fundamentally disagree your choice is 'right'..
>>
>
> Sure.
>
>
>  This is obviously subjective, so I don't think that's a fair assertion.
>>
>
> By 'right', I don't necessarily mean 'the most efficient'. I mean that the
> code should be correct. It's ok if extra work is involved in creating the
> most efficient version.


But this solution is equally correct, and doesn't make any sacrifice for
the most efficient version:
  methods are not virtual by default.
  overriding any common method is an error (great, now I know if I've made
any sort of mistake)
  a method declared virtual may be overridden expected, and
virtual-ness safely confirmed by the lack of compile error.
  to override a regular method (a rare thing to do, but still your primary
safety concern), you use an explicit keyword to do it. now it's absolutely
intentional.

This provides all the same safety guarantees, ie, your 'right'-ness, and
doesn't sacrifice: performance/false-virtual risk, 'final' keyword spam,
risk of forgetfulness and the junior coder factor... surely this is MORE
'right', by any measure? :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120106/81c086b6/attachment.html>


More information about the Digitalmars-d mailing list