manual memory management

Mehrdad wfunction at hotmail.com
Wed Jan 9 12:09:01 PST 2013


On Wednesday, 9 January 2013 at 19:34:19 UTC, Andrei Alexandrescu 
wrote:
> At the end of the day if references are part of the language 
> and programs can build arbitrary reference topologies, safety 
> entails GC.


It looks like a non sequitur to me... wouldn't this work?

A language X has a built-in data type called Reference, and no 
classes.

The only thing you can do with it are using these functions:

Reference CreateObject(Reference typename);
Reference DeleteValue(Reference object, Reference field);
Reference GetValue(Reference object, Reference field);
Reference SetValue(Reference object, Reference field, Reference 
value);

Given _just_ these functions you can build _any_ arbitrary 
reference topology whatsoever. There's no need for a GC to be 
running, and it's completely manual memory management.


It's memory-safe too. What am I missing here?


More information about the Digitalmars-d mailing list