In fact there is no order of destruction. And this is one of the
most annoying D problems I recently had to deal with. Look at
this example: http://dpaste.dzfl.pl/f3f860b0. This time, it
segfaulted. Next time it may (in theory) not, because the dtor of
a is called before the one of b. A holds a
On 4/9/13, Henning Pohl wrote:
> In the destructor of A I expect b either to be null or a valid
> instance of B (which has not been destroyed yet).
Hmm yeah I hoped to see it be null too.
> This is IMO a huge drawback
> towards reference counting with strong/weak references.
I don't think D cla
On Tue, 09 Apr 2013 15:55:09 -0400, Henning Pohl
wrote:
In fact there is no order of destruction. And this is one of the most
annoying D problems I recently had to deal with. Look at this example:
http://dpaste.dzfl.pl/f3f860b0. This time, it segfaulted. Next time it
may (in theory) not,
On Tuesday, 9 April 2013 at 20:46:12 UTC, Steven Schveighoffer
wrote:
No. You are not allowed to access any GC-managed resources
inside a destructor.
Okay, I finally found it:
http://dlang.org/class.html#destructors. But it's not listed
here: http://dlang.org/garbage.html.
And it won't be null
On Tue, 09 Apr 2013 20:55:09 +0100, Henning Pohl
wrote:
In fact there is no order of destruction. And this is one of the most
annoying D problems I recently had to deal with. Look at this example:
http://dpaste.dzfl.pl/f3f860b0. This time, it segfaulted. Next time it
may (in theory) not,
On Wed, 10 Apr 2013 10:48:30 +0100, Henning Pohl
wrote:
On Tuesday, 9 April 2013 at 20:46:12 UTC, Steven Schveighoffer wrote:
No. You are not allowed to access any GC-managed resources inside a
destructor.
Okay, I finally found it: http://dlang.org/class.html#destructors. But
it's not li
On Wed, 10 Apr 2013 11:08:22 +0100, Regan Heath
wrote:
On Wed, 10 Apr 2013 10:48:30 +0100, Henning Pohl
wrote:
On Tuesday, 9 April 2013 at 20:46:12 UTC, Steven Schveighoffer wrote:
No. You are not allowed to access any GC-managed resources inside a
destructor.
Okay, I finally found it
On Wed, 10 Apr 2013 05:48:30 -0400, Henning Pohl
wrote:
Any instance of B always needs to be destructed _before_ the A it's
connected to. How do you express this in D?
You must not rely on the GC if you need ordered destruction.
Even though destructors CAN destroy other resources, it's al