Old problem with performance

Michel Fortin michel.fortin at michelf.com
Mon Feb 9 04:51:22 PST 2009


On 2009-02-09 07:34:44 -0500, Michel Fortin <michel.fortin at michelf.com> said:

> The only advantage you have is that your type can be derived from 
> another so you can reuse some of its implementation. There are other 
> ways to acheive that in D however (mixins come to mind).

That said, I'm not against adding struct inheritance if it can be done 
in a way that avoids slicing problems. I think this can be acheived by 
making slicing innoculous:

1. forbid overriding base members
2. forbid destructors in derived strucs (or else slicing would lose the 
destructor)

Open questions:
Is that constraining enough to avoid slicing problems?
Do these constrains make the feature irrelevant?

-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/




More information about the Digitalmars-d mailing list