True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Denis Shelomovskij
This idea is too obvious and I suppose I'm the only one not knowing it, but I have never seen it's implementation. Why? The idea: 1. `Object` class has hidden `isAlive` field which is true since construction and up to finalization. 2. Every method asserts that the object is alive first. 3. The

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Jonathan M Davis
On Friday, May 04, 2012 18:28:51 Denis Shelomovskij wrote: > This idea is too obvious and I suppose I'm the only one not knowing it, > but I have never seen it's implementation. Why? > > The idea: > 1. `Object` class has hidden `isAlive` field which is true since > construction and up to finalizat

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Simen Kjaeraas
On Fri, 04 May 2012 19:29:11 +0200, Jonathan M Davis wrote: On Friday, May 04, 2012 18:28:51 Denis Shelomovskij wrote: This idea is too obvious and I suppose I'm the only one not knowing it, but I have never seen it's implementation. Why? The idea: 1. `Object` class has hidden `isAlive` fie

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Sean Kelly
On May 4, 2012, at 7:28 AM, Denis Shelomovskij wrote: > This idea is too obvious and I suppose I'm the only one not knowing it, but I > have never seen it's implementation. Why? > > The idea: > 1. `Object` class has hidden `isAlive` field which is true since construction > and up to finalizatio

Re: True disposable objects (add "Finalized!" assertion)

2012-05-04 Thread Steven Schveighoffer
On Fri, 04 May 2012 14:50:06 -0400, Simen Kjaeraas wrote: I believe the idea was that it'd blow up if you use it unwisely. clear might do that, but if you're unlucky, it'll 'work' just fine, giving you problems later. clear zeros out the vtable, so it's highly unlikely it "just works".

Re: True disposable objects (add "Finalized!" assertion)

2012-05-05 Thread Simen Kjaeraas
On Fri, 04 May 2012 21:07:20 +0200, Steven Schveighoffer wrote: On Fri, 04 May 2012 14:50:06 -0400, Simen Kjaeraas wrote: I believe the idea was that it'd blow up if you use it unwisely. clear might do that, but if you're unlucky, it'll 'work' just fine, giving you problems later.

Re: True disposable objects (add "Finalized!" assertion)

2012-05-07 Thread Steven Schveighoffer
On Sat, 05 May 2012 17:12:14 -0400, Simen Kjaeraas wrote: On Fri, 04 May 2012 21:07:20 +0200, Steven Schveighoffer wrote: On Fri, 04 May 2012 14:50:06 -0400, Simen Kjaeraas wrote: I believe the idea was that it'd blow up if you use it unwisely. clear might do that, but if you're un