Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
Thank you, this clarified a lot.

Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:50:44 UTC, Adam D. Ruppe wrote: On Sunday, 20 September 2015 at 18:41:18 UTC, anonymous wrote: But that doesn't change either. I think Adam is mistaken here. huh, I just checked the source... and you are right, it doesn't set classes to null itself, but does

Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:39:57 UTC, Adam D. Ruppe wrote: On Sunday, 20 September 2015 at 18:34:37 UTC, Lambert Duijst wrote: Oh that surprises me a bit, because I read in the list of deprecated features that delete is deprecated and that the right thing to do is to use destroy instead

Re: Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
On Sunday, 20 September 2015 at 18:21:52 UTC, Adam D. Ruppe wrote: Very simple: destroy(s) (or s.destroy but i prefer destroy(s)) will set the reference it is passed to null because you aren't supposed to use it anymore. So after calling destroy(s), s is null, so it segfaults when you try to

Question about Object.destroy

2015-09-20 Thread Lambert Duijst via Digitalmars-d-learn
Hi all, I have a question about the following piece of code that I wrote to experiment with explicit deletion of objects. I am interested in this because, even though D has a garbage collection, sometimes an object holds a non-memory resource, such as a file handle. In these cases explicit ca