System programming in D (Was: The God Language)

Manu turkeyman at gmail.com
Thu Jan 5 13:58:05 PST 2012


On 5 January 2012 23:34, Walter Bright <newshound2 at digitalmars.com> wrote:

> On 1/5/2012 3:58 AM, Manu wrote:
>
>> How is this possible, when all functions are virtual, without whole
>> program
>> optimisation?
>>
>
> Only public non-final class member functions are virtual. Furthermore, as
> in C++, the compiler can sometimes determine that a virtual function is
> being called directly, and will do so (or inline it).
>

Can you define 'sometimes'? I have trouble believing that this will occur
very often. The stars aligning to that level of precision seems totally
unreliable.

Consider the UI code snippet I posted earlier (I've lost the link), most
functions are public and not virtual (mostly accessors, or fairly simple
mutators), and they could only be identified to be not-overridden with
whole program optimisation...
The fact you mention potential for inline-ing actually heightens my
criticism with another detail I hadn't considered ;) ... Now all my trivial
methods won't only be virtual-called, they won't be inlined either!

I'm genuinely scared of people forgetting to type final (including
myself)... And it's hard as an external coder to go and clean up too.
Adding final blocks to someone elses existing code, you don't necessarily
know what is truly virtual or not... *mumble mumble*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20120105/b167214a/attachment.html>


More information about the Digitalmars-d mailing list