Future of memory management in D

H. S. Teoh hsteoh at quickfur.ath.cx
Tue Nov 16 23:17:45 UTC 2021


On Tue, Nov 16, 2021 at 10:38:13PM +0000, IGotD- via Digitalmars-d wrote:
> On Tuesday, 16 November 2021 at 18:17:29 UTC, Rumbu wrote:
> > 
> > Now, without a gc, more than half of the language risks to become
> > unusable and that's why I ask myself how do you see the future of
> > the memory management in D?
> > 
> > Not assuming a standard memory model can be a mistake, the C crowd
> > will always complain that they cannot use feature X, others will
> > complain that they cannot use feature Y because it is not finished
> > or its semantics are stuck in 2000's.
> 
> The Achilles heel of D and its memory management was never the GC
> itself or GC/not GC. It was that D didn't separate raw pointers from
> managed pointers as different types. If D had done that, it would have
> many more options.
[...]

That may be true, but having multiple incompatible pointer types mixed
together in the language makes code far more complex (and prone to
bugs). The type system would be a lot more complex than it is today. And
it would not really solve the problem of interop between, e.g., two
different 3rd party libraries that expect different pointer types.

Having a single unified pointer type increases compatibility between
code of diverse origins, though of course that comes at a price.


T

-- 
"Maybe" is a strange word.  When mom or dad says it it means "yes", but
when my big brothers say it it means "no"! -- PJ jr.


More information about the Digitalmars-d mailing list