new principle of division between structures and classes
Denis Koroskin
2korden at gmail.com
Mon Jan 12 17:19:51 PST 2009
On Tue, 13 Jan 2009 04:17:22 +0300, Andrei Alexandrescu <SeeWebsiteForEmail at erdani.org> wrote:
> 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
If the compiler can show the address of a struct is not taken, it should recycle the memory :p
More information about the Digitalmars-d
mailing list