Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-15 Thread Steven Schveighoffer via Digitalmars-d-learn
On 12/13/14 2:03 AM, Andrey Derzhavin wrote: Hello! We have object, for example, objA. ObjectAType objA = new ObjectAType(...); // we have a many references to objA void someFunction1(...) { // destroying the objA destroy(one_of_the_refToObjA); // } void

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-15 Thread Andrey Derzhavin via Digitalmars-d-learn
Thank you very much, Steven!

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-14 Thread via Digitalmars-d-learn
On Saturday, 13 December 2014 at 21:20:43 UTC, Andrey Derzhavin wrote: import std.stdio; class ObjectAType { bool ok; this() {ok = true;} } void main() { auto a = new ObjectAType; assert(a.ok); destroy(a); assert(!a.ok); // a has been destroyed. } This method of

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-14 Thread Dan Olson via Digitalmars-d-learn
Marc Schütz\ schue...@gmx.net writes: On Saturday, 13 December 2014 at 21:20:43 UTC, Andrey Derzhavin wrote: import std.stdio; class ObjectAType { bool ok; this() {ok = true;} } void main() { auto a = new ObjectAType; assert(a.ok); destroy(a); assert(!a.ok); // a

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-14 Thread via Digitalmars-d-learn
On Sunday, 14 December 2014 at 16:05:13 UTC, Dan Olson wrote: Marc Schütz\ schue...@gmx.net writes: On Saturday, 13 December 2014 at 21:20:43 UTC, Andrey Derzhavin wrote: import std.stdio; class ObjectAType { bool ok; this() {ok = true;} } void main() { auto a = new ObjectAType;

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-13 Thread Andrey Derzhavin via Digitalmars-d-learn
import std.stdio; class ObjectAType { bool ok; this() {ok = true;} } void main() { auto a = new ObjectAType; assert(a.ok); destroy(a); assert(!a.ok); // a has been destroyed. } This method of detection of collected objects is what I needed. Thanks to everybody for

Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-12 Thread Andrey Derzhavin via Digitalmars-d-learn
Hello! We have object, for example, objA. ObjectAType objA = new ObjectAType(...); // we have a many references to objA void someFunction1(...) { // destroying the objA destroy(one_of_the_refToObjA); // } void someFunction2() { // segmentation fault if the objA is

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-12 Thread ketmar via Digitalmars-d-learn
On Sat, 13 Dec 2014 07:03:22 + Andrey Derzhavin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: Hello! We have object, for example, objA. ObjectAType objA = new ObjectAType(...); // we have a many references to objA void someFunction1(...) { // destroying

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-12 Thread ketmar via Digitalmars-d-learn
On Sat, 13 Dec 2014 07:03:22 + Andrey Derzhavin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: p.s. you can emulate weak links if this is what you want to have. i.e. references to object that will not stop GC to collect that object and which will be auto-nullified if the

Re: Are there any methods like isDestroyed or isDisposed to detect whether some object is destroyed or not?

2014-12-12 Thread ketmar via Digitalmars-d-learn
On Sat, 13 Dec 2014 07:03:22 + Andrey Derzhavin via Digitalmars-d-learn digitalmars-d-learn@puremagic.com wrote: p.p.s. please-please-please don't invent other hacks with `rt_attachDisposeEvent()`! such hackery will not do you good in the long term. signature.asc Description: PGP signature