What are the prominent downsides of the D programming language?

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Sep 30 00:28:34 UTC 2020


On Tue, Sep 29, 2020 at 05:13:31PM -0700, Walter Bright via Digitalmars-d wrote:
> On 9/29/2020 2:56 AM, Petar Kirov [ZombineDev] wrote:
> > I don't have experience with multiple inheritance in Eiffel, but it
> > would be shame that in a language with `static if`, `mixin
> > template`s, `static foreach`, etc. we can't figure out a way to make
> > it work.

I betcha you could do it as a library. ;-)


> The more interesting question is "is it worthwhile to make it work?"
> No.
> 
> Too many paths to implicit conversions (and that's really what MI is)
> leads to nothing but confusion.
[...]

Yeah, after many years of loving to sprinkle alias this everywhere, I'm
starting to realize that it's not such a good idea after all. It leads
to code that looks like it's correct, but actually it does something
else. Give it a few more iterations of refactoring, bugfixes, and
feature additions, and the code quickly becomes totally opaque and hard
to reason about. Or just plain ugly because the data structures have
turned into a Frankenstein monster where sometimes it's type A,
sometimes it's type B, and you have to insert random shunts everywhere
to interconvert between them where implicit conversion didn't happen
automatically.

Same thing with C++'s implicit constructions and Koenig lookup. It's
clever, it's cool, and super-convenient to use... until you have to
debug the code, then all of a sudden you're scratching your head, where
on earth is that implicit intermediate type that my argument got
silently converted to, and which overload did this call end up in?!
Sometimes even the debugger won't help you (the implicit conversion got
inlined, so you don't even see the intermediate type, just the wrong
result in the target function).  Pretty soon, the code becomes
write-only, and maintenance costs (time to debug, time to integrate new
features, etc.) skyrocket.


T

-- 
Winners never quit, quitters never win. But those who never quit AND never win are idiots.


More information about the Digitalmars-d mailing list