Re: Thoughts on WeakMaps

2011-06-07 Thread Isaac Schlueter
On Tue, Jun 7, 2011 at 13:59, Mark S. Miller wrote: > There's no where in the standard API of the ES5 built-ins that does this > return-self pattern for purposes of chaining. There are of course JS > libraries, like jQuery, that make pervasive use of chaining. However, > ES-next built-ins should f

Re: Thoughts on WeakMaps

2011-06-07 Thread Brendan Eich
On Jun 7, 2011, at 1:59 PM, Mark S. Miller wrote: > Even from a security perspective, I don't think the leakier choice here is > fatal. But it does make it yet harder to avoid leakage accidents. How big a > deal this is depends on what you care about. I think you've made a good case for the des

Re: Thoughts on WeakMaps

2011-06-07 Thread Mark S. Miller
On Tue, Jun 7, 2011 at 9:02 AM, Brendan Eich wrote: > > I've used that "return the old value" pattern with success before. Mark may > have a reason for not using it here, though. > > Yup. Such chaining is a dangerous emulation of the Smalltalk cascade that violates "say what you mean". Contrast:

Re: Thoughts on WeakMaps

2011-06-07 Thread Allen Wirfs-Brock
On Jun 7, 2011, at 9:02 AM, Brendan Eich wrote: > On Jun 7, 2011, at 7:41 AM, David Bruant wrote: > >> Le 06/06/2011 17:31, David Bruant a écrit : >>> myWeakMap.set(key, value) doesn't return anything. It could return the >>> previous value for the key (if such a thing exists). Is it intentional

Re: Thoughts on WeakMaps

2011-06-07 Thread David Herman
Hi David, [A propos of nothing, can I ask that you either change your font or use plain-text email? Your font shows up almost unreadably small in my mail client.] > I'm currently working on the WeakMap documentation [1] and I have thought of > two points: > 1) myWeakMap.set(key, value) doesn't

Re: Thoughts on WeakMaps

2011-06-07 Thread Brendan Eich
On Jun 7, 2011, at 7:41 AM, David Bruant wrote: > Le 06/06/2011 17:31, David Bruant a écrit : >> myWeakMap.set(key, value) doesn't return anything. It could return the >> previous value for the key (if such a thing exists). Is it intentional that >> the set function doesn't return anything? > An

Re: Thoughts on WeakMaps

2011-06-07 Thread Allen Wirfs-Brock
On Jun 7, 2011, at 8:02 AM, Mark S. Miller wrote: > On Tue, Jun 7, 2011 at 7:41 AM, David Bruant wrote: > Le 06/06/2011 17:31, David Bruant a écrit : > >> myWeakMap.set(key, value) doesn't return anything. It could return the >> previous value for the key (if such a thing exists). Is it intent

Re: Thoughts on WeakMaps

2011-06-07 Thread Juan Ignacio Dopazo
On Tue, Jun 7, 2011 at 11:41 AM, David Bruant wrote: > Le 06/06/2011 17:31, David Bruant a écrit : > > myWeakMap.set(key, value) doesn't return anything. It could return the > previous value for the key (if such a thing exists). Is it intentional that > the set function doesn't return anything?

Re: Thoughts on WeakMaps

2011-06-07 Thread Mark S. Miller
On Tue, Jun 7, 2011 at 7:41 AM, David Bruant wrote: > Le 06/06/2011 17:31, David Bruant a écrit : > > myWeakMap.set(key, value) doesn't return anything. It could return the > previous value for the key (if such a thing exists). Is it intentional that > the set function doesn't return anything? >

Re: Thoughts on WeakMaps

2011-06-07 Thread David Bruant
Le 06/06/2011 17:31, David Bruant a écrit : > myWeakMap.set(key, value) doesn't return anything. It could return the > previous value for the key (if such a thing exists). Is it intentional > that the set function doesn't return anything? Anyone has thoughts on this point? David __

Re: Thoughts on WeakMaps

2011-06-07 Thread Mark S. Miller
On Tue, Jun 7, 2011 at 6:54 AM, David Bruant wrote: > Le 06/06/2011 18:30, Mark S. Miller a écrit : > > > > On Mon, Jun 6, 2011 at 2:46 PM, David Bruant wrote: > >> Le 06/06/2011 17:41, Mike Samuel a écrit : >> > 2011/6/6 David Bruant : >> >> The consequence of this second point is wondering wh

Re: Thoughts on WeakMaps

2011-06-07 Thread David Bruant
Le 06/06/2011 18:30, Mark S. Miller a écrit : > > > On Mon, Jun 6, 2011 at 2:46 PM, David Bruant > wrote: > > Le 06/06/2011 17:41, Mike Samuel a écrit : > > 2011/6/6 David Bruant >: > >> The consequence of this second poi

Re: Thoughts on WeakMaps

2011-06-06 Thread Mark S. Miller
On Mon, Jun 6, 2011 at 2:46 PM, David Bruant wrote: > Le 06/06/2011 17:41, Mike Samuel a écrit : > > 2011/6/6 David Bruant : > >> The consequence of this second point is wondering whether it's a good > idea > >> to standardize WeakMap (instead of Map) at all. > > Besides a lack of out-of-memory e

Re: Thoughts on WeakMaps

2011-06-06 Thread Mike Samuel
2011/6/6 David Bruant : > Le 06/06/2011 17:41, Mike Samuel a écrit : >> 2011/6/6 David Bruant : >>> The consequence of this second point is wondering whether it's a good idea >>> to standardize WeakMap (instead of Map) at all. >> Besides a lack of out-of-memory errors and performance, a program >>

Re: Thoughts on WeakMaps

2011-06-06 Thread David Bruant
Le 06/06/2011 17:41, Mike Samuel a écrit : > 2011/6/6 David Bruant : >> The consequence of this second point is wondering whether it's a good idea >> to standardize WeakMap (instead of Map) at all. > Besides a lack of out-of-memory errors and performance, a program > using an object key map that do

Re: Thoughts on WeakMaps

2011-06-06 Thread Mike Samuel
2011/6/6 David Bruant : > 2) The notion of weak reference as used in current WeakMap seems to be > assuming that the garbage collector will work on whether objects are > reachable or not. I have read (I thought it was the wikipedia page, but it > apparently wasn't) that there is another notion for

Thoughts on WeakMaps

2011-06-06 Thread David Bruant
Hi, I'm currently working on the WeakMap documentation [1] and I have thought of two points: 1) myWeakMap.set(key, value) doesn't return anything. It could return the previous value for the key (if such a thing exists). Is it intentional that the set function doesn't return anything? 2) The notio