--- In flexcoders@yahoogroups.com, Alex Harui <aha...@...> wrote:
>
> I think Amy's point is that, w/o a reference to the anonfun, you 
can't call removeEventListener on it.  If I do:
> 
> someObj.addEventListener("foo", function (e:Event) { ... } );
> 
> someObj will release the anonfun when it gets garbage collected.  
However, until that time, all objects in the scope chain won't be 
collectable.  I don't know if that's the case in Java.

Yes, that's what I meant.  I guess it depends on how you're setting 
up someObj as to whether someObj would be eligible for garbage 
collection itself.  But the event listeners can't be released 
independently, except if the thing Ralf suggested works (interesting 
suggestion, Ralf...I use arguments.callee for other things sometimes 
myself...never thought of using it that was).

Honestly, the reason I don't use anonymous functions is that they 
don't "feel" like good coding practice to me.

-Amy

Reply via email to