More radical ideas about gc and reference counting

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Mon May 12 01:54:58 PDT 2014


On 5/11/2014 10:57 PM, Marco Leise wrote:
> Am Sun, 11 May 2014 17:50:25 -0700
> schrieb Walter Bright <newshound2 at digitalmars.com>:
>
>> As long as those pointers don't escape. Am I right in that one cannot store a
>> borrowed pointer into a global data structure?
>
> Right, and that's the point and entirely positive-to-do™.

This means that a global data structure in Rust has to decide what memory 
allocation scheme its contents must use, and cannot (without tagging) mix memory 
allocation schemes.

For example, let's say a compiler has internally a single hash table of strings. 
With a GC, those strings can be statically allocated, or on the GC heap, or 
anything with a lifetime longer than the table's. But I don't see how this could 
work in Rust.



More information about the Digitalmars-d mailing list