Re: [Flashcoders] AS3 Destructors and Garbage Collection ...

2008-08-02 Thread Paul Andrews
- Original Message - 
From: "Steven Sacks" <[EMAIL PROTECTED]>

To: "Flash Coders List" 
Sent: Saturday, August 02, 2008 1:45 PM
Subject: Re: [Flashcoders] AS3 Destructors and Garbage Collection ...


It's a dangerous business removing instances when there are still 
references to them. Check out as3 weak references.


So dangerous that you can't do it.  ;)


LOL, absolutely.

I once worked as a developer using C++ on a project for two years. Our 
biggest problem was dangling references to objects that were temporaries and 
reused. So I think that Actionscript devlopers sometimes have rose tinted 
glasses when looking at forced garbage collection.


Mind you, I'm not sure very many actionscript developers have worked for two 
years on a project..  ;-)



The Flash 10 Player has a function to force the GC to run, btw.
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders



___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 Destructors and Garbage Collection ...

2008-08-02 Thread Steven Sacks
It's a dangerous business removing instances when there are still 
references to them. Check out as3 weak references.


So dangerous that you can't do it.  ;)

The Flash 10 Player has a function to force the GC to run, btw.
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


Re: [Flashcoders] AS3 Destructors and Garbage Collection ...

2008-08-02 Thread Paul Andrews
- Original Message - 
From: "S0 F1" <[EMAIL PROTECTED]>

To: 
Sent: Saturday, August 02, 2008 9:11 AM
Subject: [Flashcoders] AS3 Destructors and Garbage Collection ...



What is the point of a class (one that is instantiated and used via
composition within another class) having a destructor?


Cleaning up a class can be involved, so destructors can be usefull to allow 
the developer to control that cleanup (maybe even propogate events). BUT 
there are no destructors in AS3..



Shouldn't the class that composites the other class (let's say a parent
class compositing a sub class) just be able to remove all references to 
sub
class and then it will be garbage collected (making sure nowhere else in 
the

application makes reference to the sub class).


The class that is trying to remove the composite instance may not be aware 
of other references to the class and have no way to find them.



And further more, why is there no way to flag an object for garbage
collection and then force the garbage collector to dispose of the class?


It's a dangerous business removing instances when there are still references 
to them. Check out as3 weak references.



Any thoughts on this?


A really controversial subject for AS3 already discussed at great length on 
flexcoders. I think you've opened the floodgates here, too.


Paul


Thanks.
S0 F1.


___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


[Flashcoders] AS3 Destructors and Garbage Collection ...

2008-08-02 Thread S0 F1
What is the point of a class (one that is instantiated and used via
composition within another class) having a destructor?

Shouldn't the class that composites the other class (let's say a parent
class compositing a sub class) just be able to remove all references to sub
class and then it will be garbage collected (making sure nowhere else in the
application makes reference to the sub class).

And further more, why is there no way to flag an object for garbage
collection and then force the garbage collector to dispose of the class?

Any thoughts on this?

Thanks.
S0 F1.
___
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders