On Wednesday, 9 September 2015 at 07:19:58 UTC, Q wrote:
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
On Wednesday, 9 September 2015 at 07:19:58 UTC, Q wrote:
Besides, we live in 2015 and that is not C where I have to
clean my code manually, so this option would be ridiculous :D
The difference is that in C you need to manage POD memory too.
Manual management of non-POD resources is a problem o
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. :)
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
destroyed unless you have the user code take ownership of it.
(This
On Wednesday, 9 September 2015 at 14:36:24 UTC, Q wrote:
But if others use my code they must think about finalizing the
classes? That is very awkward.
classes, yes but structs, no.
I'll take a look at Rust and otherwise I will stick with C++.
Thanks for you answer. :)
Well, resource managem
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
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.
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 default. If that's what you want, just do it
the plain way with simple `new
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 defaul
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 GC.collect at any time.
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 GC.co
On Wednesday, 9 September 2015 at 15:37:50 UTC, Q wrote:
Yes, but according to the specs it is not guaranteed that the
GC calls the DTor if the Object is collected.
Where? This page says pretty plainly:
http://dlang.org/class.html#destructors
"The garbage collector calls the destructor functi
On Wednesday, 9 September 2015 at 15:37:50 UTC, Q wrote:
Yes, but according to the specs it is not guaranteed that the
GC calls the DTor if the Object is collected.
Note that I believe this is the same as in Java (though not C#,
interestingly enough). In Java an object's destructor is not
gua
13 matches
Mail list logo