GC object finalization not guaranteed
Christopher Wright
dhasenan at gmail.com
Sun Apr 19 06:22:09 PDT 2009
Daniel Keep wrote:
>
> Walter Bright wrote:
>> Leandro Lucarella wrote:
>>> Close a connection gracefully for example, I guess (I mean, send a "bye"
>>> packed, not just close the socket abruptly). Same for closing files
>>> writing some mark or something. They can be risky when finalization is
>>> not
>>> deterministic though.
>> Scoped objects should be used for that, not gc.
>
> But you can't tell in a dtor whether you're being destroyed
> deterministically or not. The only safe assumption is that you aren't,
> thus rendering dtors worse than useless.
>
> All we'd need is a bool passed to a dtor to tell it whether it's being
> destroyed deterministically or not and all will be rainbows and sunshine.
>
> ... except for the opDotExpr discussion. Anyone who posts to that
> thread is kuh-razy!
>
> -- Daniel
That should be a relatively easy change, actually, and it's a pretty
good idea.
More information about the Digitalmars-d
mailing list