On Friday, 23 January 2015 at 21:00:08 UTC, Steven Schveighoffer
wrote:
On 1/23/15 3:40 PM, deadalnix wrote:
On Friday, 23 January 2015 at 13:12:44 UTC, Steven Schveighoffer wrote:
On 1/23/15 8:05 AM, Matthias Bentrup wrote:
On Friday, 23 January 2015 at 10:53:54 UTC, aldanor wrote:
On Friday, 23 January 2015 at 08:58:11 UTC, Ola Fosheim Grøstad wrote:
How about banning GC-allocation of classes with destructors?
Uh... what? ^__^

Maybe just ban classes altogether then?

No, don't ban them, that will break to much code. Just don't execute them. Any application that depends on destructors being called by the GC
is broken in 9 out of 10 cases anyway.

This is very wrong.

This is as per spec :)

No, spec says your dtor is not guaranteed to run for unreferenced memory. It doesn't say your destructor may not be run even when the memory is collected. In fact, it says "The garbage collector calls the destructor function when the object is deleted."

But my real point is that depending on dtors being called by the GC is not broken 90% of the time.

-Steve

You are right, on a literal point, but I think that what he was
saying was something like:

"Any application that depends on object being collected in a
collect circle as unreferenced, so that depends on destructors
are being called by the GC is broken in 9 out of 10 cases anyway"

I agree with aldanor about his argumentation that a warning would
be appropriate: it's a very common pitfall, and a pitfall that
simply cast a bad light on the language in newcomers' minds when
it occurs at runtime.
Also if a lint tool can catch it, we all are conscious of the big
effort that the community leaders are putting on picturing a
better language for newbies (please, no pun intended, really!)
--
Paolo

Reply via email to