D 2015/2016 Vision?

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Wed Oct 7 08:39:38 PDT 2015


On Wednesday, 7 October 2015 at 15:13:40 UTC, Jonathan M Davis 
wrote:
> the GC heap, which is unnecessarily limiting, particularly 
> since in many cases, it's perfectly okay to let objects that 
> might normally be destroy deterministically to be destroyed at 
> the GC's leisure.

This is a costly (in terms of collection) and unreliable approach 
to resource managment, so it ought to be removed and replaced 
with something more robust with less overhead.

> speculation on my part. Regardless, if we have a proper 
> ref-counting mechanism for classes (built-in or not doesn't 
> necessarily matter - it just needs to work), then the folks 
> that need deterministic destruction with polymorphism get it.

Proper reference counting generally requires a lot of programmer 
attention if you want to get what C++ offers.

1. There is a need to add support for weak pointers so you can 
avoid circular references, this leads to double indirection.

2. There is a need to add support aliasing pointers (pointers to 
members) that increase the ownership refcount to prevent 
premature destruction if you retain a pointer to a member.

3. For multi threading you need to have atomics both on the 
counter and on the pointer  (coming in C++17). This is also 
needed for cache-objects IMO.




More information about the Digitalmars-d mailing list