Re: JavaScript VS. Weak references

2012-02-07 Thread Maciek Sakrejda
On Tue, Feb 7, 2012 at 11:09 PM, Martin Heidegger wrote: > I think I am talking about this: > http://gingerbinger.com/2010/07/actionscript-3-0-events-the-myth-of-useweakreference/ Nice read, thanks. > Would you be interested in a working group: "Remove the weak"? Sure, potentially. I certainly

Re: JavaScript VS. Weak references

2012-02-07 Thread Martin Heidegger
I think I am talking about this: http://gingerbinger.com/2010/07/actionscript-3-0-events-the-myth-of-useweakreference/ Of course the mentioned example of me is irrelevant but that doesn't make the current use of weak references in the system less problematic. Would you be interested in a worki

Re: JavaScript VS. Weak references

2012-02-07 Thread Alex Harui
On 2/7/12 11:33 AM, "Martin Heidegger" wrote: > This means to me: Any use of > weak Dictionaries and weak event listeners would need to vanish from the > Flex SDK to actually make it portable. > > I just wanted to point that out. It might be interesting to a few. > > And related to that two

Re: JavaScript VS. Weak references

2012-02-07 Thread Maciek Sakrejda
> Ah, I guess I should go to bed, gn8 You were right up to Flash Player 8 ;) http://www.adobe.com/devnet/flashplayer/articles/garbage_collection.html (that's when FP switched from ref counting to mark-and-sweep, which avoids problems with circular references) Still, weak references are certainl

Re: JavaScript VS. Weak references

2012-02-07 Thread Martin Heidegger
On 08/02/2012 05:36, Maciek Sakrejda wrote: How so?... My very tired brain pictures a implementation like: class EventDispatcher { private var _listeners: Object = {}; public function addEventListener(event: String, listener: Function) { if((_listeners[event] ||= []).indexOf(listener)

Re: JavaScript VS. Weak references

2012-02-07 Thread Maciek Sakrejda
> Yeah, its funny how such a language construct actually is implemented in > Firefox without the world knowing. Chrome/Opera and IE have nothing alike. > However: It will not become standard before the release of IE10 and > therefore will take - estimate at least more 5 years > until it can be safe

RE: JavaScript VS. Weak references

2012-02-07 Thread Frédéric THOMAS
Personally, that's a long time I think that destructors would be beneficial :p Frédéric THOMAS > Date: Wed, 8 Feb 2012 05:29:31 +0900 > From: m...@leichtgewicht.at > To: flex-dev@incubator.apache.org > Subject: Re: JavaScript VS. Weak references > > On 08/02/2012 05:21

Re: JavaScript VS. Weak references

2012-02-07 Thread Martin Heidegger
On 08/02/2012 05:21, Frédéric THOMAS wrote: In the section "Circular references collection" it's explained that the reference is cleaned up when the outer element dies but may be is not what you looked for ? Frédéric THOMAS Ah! Now I understand the meaning. Its quite late here, should be in b

Re: JavaScript VS. Weak references

2012-02-07 Thread Martin Heidegger
On 08/02/2012 05:14, Maciek Sakrejda wrote: Weak references are on the horizon for JS: http://wiki.ecmascript.org/doku.php?id=harmony:weak_maps#weakmap Yeah, its funny how such a language construct actually is implemented in Firefox without the world knowing. Chrome/Opera and IE have nothing ali

RE: JavaScript VS. Weak references

2012-02-07 Thread Frédéric THOMAS
dev@incubator.apache.org > Subject: Re: JavaScript VS. Weak references > > The content of the link says nothing about "addEventlistener". > > yours > Martin. > > On 08/02/2012 05:03, Frédéric THOMAS wrote: > > I guess you will have element of response here >

Re: JavaScript VS. Weak references

2012-02-07 Thread Maciek Sakrejda
Weak references are on the horizon for JS: http://wiki.ecmascript.org/doku.php?id=harmony:weak_maps#weakmap > And related to that two questions: >  1) Does anyone know how browsers avoid memory leaks with addEventListener ? Not all listeners have to be weak references. If what you're listening to

Re: JavaScript VS. Weak references

2012-02-07 Thread Martin Heidegger
The content of the link says nothing about "addEventlistener". yours Martin. On 08/02/2012 05:03, Frédéric THOMAS wrote: I guess you will have element of response here http://javascript.info/tutorial/memory-leaks Frédéric THOMAS

JavaScript VS. Weak references

2012-02-07 Thread Martin Heidegger
Hello List, when I recently thought about a way to get AS3 code to JavaScript I got into a major concept problem related to Weak references. As maybe most of you know weak references are not supported by JavaScript. However: The current code using addEventListener() relies heavily on weak ref