Future of memory management in D
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Wed Nov 17 09:04:42 UTC 2021
On Wednesday, 17 November 2021 at 01:23:45 UTC, H. S. Teoh wrote:
> Years ago, before @nogc was implemented, people were clamoring
> for it, saying that if we could only have the compiler enforce
> no GC use, hordes of C/C++ programmers would come flocking to
> us.
>
> Today, we have @nogc implemented and working, and the hordes
> haven't come yet.
@nogc gave those who understand system level programming a signal
of direction. I don't remmber people demanding it, IIRC Walter
just did it. Nobody said it was significant.
> Now people are clamoring for ref-counting and getting rid of GC
> use in Phobos. My prediction is that 10 years later, we will
> finally have ref-counting and Phobos will be @nogc, and the
> hordes of C/C++ programmers still will not come to us.
C++ has grown since then. D has chosen to waste all resources on
@safe and @live and not change. Thus C++ is too far ahead.
D should have gone with the actor model. D should have gotten rid
of global GC scanning.
But D has not chosen any model and tries to do everything, which
isn't possible. D tries to change without changing. That leads to
bloat.
Phobos suffers from bloat. The compiler suffers from bloat. The
syntax suffers from bloat. Andrei seems to think that D should
follow C++'s idea of simplifying by addition. That is a disaster
in making. C++ cannot change, D is not willing to use that to
its advantage.
Bloat is the enemy of change. D has chosen to tweak the bloat
instead of reducing it. That leads to more bloat and less change.
ImportC is added to a compiler that should have been restructured
first. Good luck with refactoring the compiler now, SDC might be
the only hope...
The global GC strategy with raw pointers and integrated C interop
is one massive source for "runtime bloat". C++ also suffers from
bloat, but has critical mass, and that is enough to keep it alive.
D is competing with Zig and Nim. They are leading. They have less
bloat AFAIK. Refocus. Forget C++ and Rust.
D should pick a memory model and runtime strategy that scales
and do it well!
Global GC does not scale when combined with C semantics. That has
always been true and will remain true. That is an undeniable fact.
If D is to be competitive something has to change. Adding bloat
wont change anything.
More information about the Digitalmars-d
mailing list