new principle of division between structures and classes

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Mon Jan 12 17:17:22 PST 2009


Bill Baxter wrote:
> So it may be worth while to have a special kind construct for
> containing data that the compiler is free to move around.  This type
> would have a hidden pointer inside of it that can be moved around by
> the gc, but applications would not be allowed to access that pointer.
>  And I suppose that means all access to the data would given via
> lvalue only.   Probably wouldn't take much on the part of the GC to
> provide the necessary hooks.  Just some sort of "relocatable alloc"
> call.  Rest could probably be handled in higher level libs.

Interesting. (Link?) Structs in D are supposed to be location 
transparent (it is unclear to me to what extent this should be enforced 
vs. just assumed), so if the compiler can show the address of a struct 
is not taken, it should be free to move it around.

Andrei



More information about the Digitalmars-d mailing list