Memory safety depends entirely on GC ?

Tobias Pankrath via Digitalmars-d digitalmars-d at puremagic.com
Mon Feb 23 11:32:13 PST 2015


Just brainstorming:

1. Move RC!T into the runtime because it can get special compiler 
attention.
2. Duplicate the const/mutable/immutable machinery for 
Scope/RC/GC classes ( / types).
3. RC!T is not struct RC { size_t cntr; T payload } but a T*. The 
allocator makes sure that the reference count is at T*-8 (or at 
T*+RCOffset!T or whatever).
4. RC!T and T (the GC managed type) implicitly convert to 
Scope!T. Scope!T makes sure that no reference escapes in an 
unsafe way (using the foundations in dip25).

Because of 3. we can have polymorphic functions that either 
return a GC allocated or an RC allocated class. It's type depends 
of the type of this, which leads to the equivalent of inout, 
let's call it @rcgc.




More information about the Digitalmars-d mailing list