Re: Concerns about weak refs and weak maps.

2010-10-29 Thread Erik Corry
I share Rick's worry about weak maps. It's not clear how to make an efficient GC in the presence of weak maps. As Brendan rightly points out there is already a lot of complexity in the GC of a typical JS implementation because it is interacting with the (typically) reference counted, C++ based

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread Brendan Eich
On Oct 29, 2010, at 12:08 AM, Erik Corry wrote: One of the hallmarks of a real language implementation vs. a 'toy scripting language' ala PHP is a good GC. I'd really like to see someone do a low-latency GC with weak maps before we hobble the language with something that can't be implemented

Usage for weak-maps

2010-10-29 Thread Peter van der Zee
What's the use case for weak maps? What would you do with it that currently impossible and why is the workaround (if any) problematic enough to warrant a weak map implementation? There's been quite a bit of discussion because of it. Especially in the area of covert channels and garbage

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread Erik Corry
2010/10/29 Brendan Eich bren...@mozilla.com: On Oct 29, 2010, at 12:08 AM, Erik Corry wrote: One of the hallmarks of a real language implementation vs. a 'toy scripting language' ala PHP is a good GC.  I'd really like to see someone do a low-latency GC with weak maps before we hobble the

Re: Usage for weak-maps

2010-10-29 Thread Boris Zbarsky
On 10/29/10 4:50 AM, Peter van der Zee wrote: What's the use case for weak maps? What would you do with it that currently impossible and why is the workaround (if any) problematic enough to warrant a weak map implementation? One case this came up recently was for Firebug, Firebug wants to

Re: Usage for weak-maps

2010-10-29 Thread P T Withington
On 2010-10-29, at 04:50, Peter van der Zee wrote: What's the use case for weak maps? What would you do with it that currently impossible and why is the workaround (if any) problematic enough to warrant a weak map implementation? Another use case was mentioned in the New topic regarding

RE: Concerns about weak refs and weak maps.

2010-10-29 Thread Allen Wirfs-Brock
Rick and Erik, I share your concerns about the importance of efficient GC for JavaScript. However, based upon direct experience, I'm not particularly concerned about the impact of Weak maps. The ES Harmony Weak Maps is derived from the Ephemeron concept first developed at Digitalk. We first

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread P T Withington
On 2010-10-28, at 17:10, Hudson, Rick wrote: GC implementation Software stacks on multicores will need GCs to become increasingly concurrent and latency free. Weak maps cause concurrent GCs and additional mutator synchronizations. While a concurrent GC already has to do some

RE: Usage for weak-maps

2010-10-29 Thread Allen Wirfs-Brock
Weak maps are used to create an association (based upon object identity) between an object (the key) and some arbitrary information. They are necessary if you need to maintain such an association and you cannot modify the key object to directly record the association. Without some sort of

Re: Usage for weak-maps

2010-10-29 Thread Bradley Meck
I have used them in two ways in practical application. A rather odd but quite interesting use case is short lived caches. Consider a recursive static function such as the Fibonacci sequence. You could hold a cache of the previous computations and allow them to be collected at the GC's leisure.

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread Brendan Eich
On Oct 29, 2010, at 3:57 AM, Erik Corry wrote: 2010/10/29 Brendan Eich bren...@mozilla.com: On Oct 29, 2010, at 12:08 AM, Erik Corry wrote: One of the hallmarks of a real language implementation vs. a 'toy scripting language' ala PHP is a good GC. I'd really like to see someone do a

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread Brendan Eich
On Oct 29, 2010, at 12:08 AM, Erik Corry wrote: Let's be careful not to add things to the language that will limit implementations from getting the sorts of modern GC implementations that Java and .NET have. Yet don't Java and .NET have weak-keyed maps of some sort? /be

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread felix
On 10/29/10 10:51, Brendan Eich wrote: On Oct 29, 2010, at 12:08 AM, Erik Corry wrote: Let's be careful not to add things to the language that will limit implementations from getting the sorts of modern GC implementations that Java and .NET have. Yet don't Java and .NET have weak-keyed maps

RE: Concerns about weak refs and weak maps.

2010-10-29 Thread Allen Wirfs-Brock
-Original Message- From: es-discuss-boun...@mozilla.org [mailto:es-discuss- boun...@mozilla.org] On Behalf Of felix Sent: Friday, October 29, 2010 12:18 PM To: Brendan Eich ... Yet don't Java and .NET have weak-keyed maps of some sort? Java has WeakHashMap, which is a map of

RE: Concerns about weak refs and weak maps.

2010-10-29 Thread Allen Wirfs-Brock
Oops, typo fixed below -Original Message- From: es-discuss-boun...@mozilla.org [mailto:es-discuss- boun...@mozilla.org] On Behalf Of Allen Wirfs-Brock Sent: Friday, October 29, 2010 12:24 PM To: felix; Brendan Eich Cc: Andreas Gal; es-discuss Subject: RE: Concerns about weak refs

RE: Concerns about weak refs and weak maps.

2010-10-29 Thread Jim Deville
C# 4.0 has WeakMap's too, and one of the goals was to work around the cyclical reference issue: http://blogs.msdn.com/b/clrteam/archive/2009/05/18/the-conditional-weak-table-enabling-dynamic-object-properties.aspx -Original Message- From: es-discuss-boun...@mozilla.org

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread felix
On 10/29/10 15:18, Jim Deville wrote: C# 4.0 has WeakMap's too, and one of the goals was to work around the cyclical reference issue: http://blogs.msdn.com/b/clrteam/archive/2009/05/18/the-conditional-weak-table-enabling-dynamic-object-properties.aspx mono implements ConditionalWeakTable

Re: Concerns about weak refs and weak maps.

2010-10-29 Thread Brendan Eich
On Oct 29, 2010, at 4:01 PM, felix wrote: On 10/29/10 15:18, Jim Deville wrote: C# 4.0 has WeakMap's too, and one of the goals was to work around the cyclical reference issue:

Re: instanceof trap and default handler for Proxies

2010-10-29 Thread Kam Kasravi
How 'bout extending proxies to provide an introspection API? From: Tom Van Cutsem tomvc...@gmail.com To: es-discuss es-discuss@mozilla.org Sent: Thu, October 28, 2010 6:02:11 AM Subject: instanceof trap and default handler for Proxies Hi, I created a strawman

Re: instanceof trap and default handler for Proxies

2010-10-29 Thread Kam Kasravi
I assume the answer is no, but can one proxy simple modules? From: Tom Van Cutsem tomvc...@gmail.com To: es-discuss es-discuss@mozilla.org Sent: Thu, October 28, 2010 6:02:11 AM Subject: instanceof trap and default handler for Proxies Hi, I created a strawman