Destructor semantics

Jonathan M Davis jmdavisprog at gmail.com
Wed Aug 11 12:09:45 PDT 2010


On Wednesday, August 11, 2010 11:33:54 Michel Fortin wrote:
> I'm not too sure that'll work very well. I think a better solution
> would be to have a way to distinguish between a struct that can be put
> on the GC heap and one that cannot. A struct that cannot go on the GC
> heap make it safe to access GC-managed members in its destructor, and
> thus can have a @safe destructor.

But couldn't the fact that a struct has a destructor make it so that it can't be 
declared anywhere but on the heap? The destructor itself could be what 
distinguishes them. I don't see a need for any other @attributes or whatnot to 
distinguish them.

- Jonathan M Davis


More information about the Digitalmars-d mailing list