What are the prominent downsides of the D programming language?

H. S. Teoh hsteoh at quickfur.ath.cx
Mon Sep 28 18:42:36 UTC 2020


On Mon, Sep 28, 2020 at 06:12:16PM +0000, mw via Digitalmars-d wrote:
> On Monday, 21 September 2020 at 10:42:55 UTC, Walter Bright wrote:
> > On 9/21/2020 2:35 AM, Ruby The Roobster wrote:
> > > One downside is that classes can't inherit from multiple classes.
> > 
> > That's a feature, not a downside. I'm not joking.
> 
> As you admitted some time earlier, the other mechanisms such as
> sub-typing, mixin has effectively introduced multiple inheritance into
> D already.

Yes, and we're already regretting it.  As it turns out, alias this (one
of the ways to do multiple inheritance in D) has quite a few nasty
corner cases that cannot be (easily) reconciled, and now we're starting
to discourage its use.  How to resolve identifier lookups when there are
conflicts, etc..  There's always a way to rationalize your way out of
it; but at the end of the day, it leads to confusing, hard-to-remember,
arbitrary rules that have counterintuitive corner cases.


> > Multiple inheritance is a horrible abstraction, all it does is
> > confuse people.
> 
> Well, if it's designed or implemented poorly in the language.

If you have a *workable* idea of how to do it *in D*, we'd love to hear
it.  I'm not holding my breath, though.

Don't get me wrong; I love alias this and use it a lot myself. But over
the years, I'm gradually beginning to see where it leads to problems.
It's useful as a quick hack or shunt to bridge two subsystems that are
kinda but not quite compatible, or to shoehorn implicit conversions into
a user-defined type, but in the long term, it leads to code smells.
(Implicit conversions are another of those things that sounds like a
good idea, is convenient to use, but in the long term leads to poor
maintainability.)


T

-- 
Your inconsistency is the only consistent thing about you! -- KD


More information about the Digitalmars-d mailing list