I
IR
andrewmcdonagh wrote:
[snip]
For the record, I was answering to:
I showed that both approaches (RAII vs GC) are as easy/safe in the
general case, that is, just fire and forget.
This becomes false as soon as you need determinism, in which case GC
becomes a nuisance: the responsability of freeing a resource in time
is then transfered on the user of the resource.
IMO this is *not* easier or less error prone, and it can even affect
safety (eg. does automatically rolling back a DB transaction on
exception ring a bell?).
One could argue that to handle this latter example, he could use a
try/finally block. Again, this is a shift of responsability on the
user of the transaction object.
So a language that *requires* you to use GC renders itself less safe
and more error prone, by imposing certain vital constructs to be
handled by the user rather than by the library.
And I have yet to find any advantage in the favor of GC, as long as
one doesn't play around with naked pointers...
Cheers,
[snip]
Hmmm... this is what I thought....
Java Finalizers are not destructors. They are not even remotely
equivalent and so we are comparing apples and pears.
For the record, I was answering to:
Cesar said:Ian Collins escreveu:
To answer that you need to question yourself if this features
allow easier programming, safely, less error prone.
I showed that both approaches (RAII vs GC) are as easy/safe in the
general case, that is, just fire and forget.
This becomes false as soon as you need determinism, in which case GC
becomes a nuisance: the responsability of freeing a resource in time
is then transfered on the user of the resource.
IMO this is *not* easier or less error prone, and it can even affect
safety (eg. does automatically rolling back a DB transaction on
exception ring a bell?).
One could argue that to handle this latter example, he could use a
try/finally block. Again, this is a shift of responsability on the
user of the transaction object.
So a language that *requires* you to use GC renders itself less safe
and more error prone, by imposing certain vital constructs to be
handled by the user rather than by the library.
And I have yet to find any advantage in the favor of GC, as long as
one doesn't play around with naked pointers...
Cheers,