Alternatives to OOP in D

Peter C peterc at gmail.com
Fri Nov 14 22:45:59 UTC 2025


On Friday, 14 November 2025 at 06:35:23 UTC, monkyyy wrote:
>
> ..

I should point out, that I'm not advocating for alternative 
models ;-)

If you need (for example) the flexibility of a heterogeneous 
collection at runtime, then class-based dynamic dispatch via 
v-tables is (by far) the easiest and most idiomatic model to meet 
that need.

It prioritizes simplicity, clarity and maintainability (i.e. 
developers time and cognitive resources get the priority in this 
model).

Yes, it comes with some runtime overhead -> pointer indirection, 
cache misses...,  but nonetheless, it is still likely to be 
suitable for most application-level development.

An alternative choice for modelling polymorphism will shift the 
priorities to something else all together.



More information about the Digitalmars-d-learn mailing list