class destruction

2015-09-09 Thread Q via Digitalmars-d-learn
Hi. I'm playing around with D for a while and I would like to switch. But here is one thing, I need an answer for. In the Docs is mentioned that it is not sure that the DTor of a class is called. But what if I have struct, which holds a C Handle which is destroyed as soon as the struct gets

Re: class destruction

2015-09-09 Thread Q via Digitalmars-d-learn
But if others use my code they must think about finalizing the classes? That is very awkward. I'll take a look at Rust and otherwise I will stick with C++. Thanks for you answer. :)

Re: class destruction

2015-09-09 Thread Q via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 15:32:58 UTC, Adam D. Ruppe wrote: On Wednesday, 9 September 2015 at 15:24:57 UTC, Q wrote: I thought that is not guaranteed, according to the docs? It is possible that the GC will never actually run, but you can force it to if you need it to by calling

Re: class destruction

2015-09-09 Thread Q via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 14:57:26 UTC, Adam D. Ruppe wrote: On Wednesday, 9 September 2015 at 07:19:58 UTC, Q wrote: Can I be sure that the Handle is destroyed as soon as the class is destroyed? It will do that automatically. Like the others said, you won't be sure when the class is

Re: class destruction

2015-09-09 Thread Q via Digitalmars-d-learn
And sorry if that sounds rude, I'm just in a hurry. I just think D is not mature enough for serious stuff. :) That is of course only my personal opinion.

Re: class destruction

2015-09-09 Thread Q via Digitalmars-d-learn
On Wednesday, 9 September 2015 at 15:19:04 UTC, Adam D. Ruppe wrote: On Wednesday, 9 September 2015 at 15:10:33 UTC, Q wrote: But since D has a GC and (per default) force to heap allocate a class. So IMO the GC should also destroy it, everything else is just awkward. Well, it *does* by