Re: es-discuss Digest, Vol 41, Issue 9

2010-07-06 Thread P T Withington
On 2010-07-04, at 04:09, Brendan Eich wrote: > Likewise for hashcode: if the object's address is one-way hashed to the > hashcode() result, but the GC moves the object, then the object will need to > grow a field to store its invariant hashcode. FWIW Dylan (and its ancestors) gets around this b

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-04 Thread Brendan Eich
On Jul 4, 2010, at 4:37 AM, Leo Meyerovich wrote: > Ah, I was confused by the use of bootstrap in "Could we bootstrap Set, Map, > and WeakMap and call it enough?" ; I thought you meant a user-level encoding > of these given language-level hashes etc. The strong maps could be efficiently built i

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-04 Thread Leo Meyerovich
>> >> ... then I still don't see how to do an encoding of weak references that >> isn't invasive (e.g., adding in a user-level GC that constructors are >> somehow guaranteed to go through). For a non-invasive approach, there might >> be probablistic guarantees achieved by API restrictions (e.g.

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-04 Thread Brendan Eich
On Jul 4, 2010, at 12:46 AM, Leo Meyerovich wrote: >> http://wiki.ecmascript.org/doku.php?id=strawman:egal > > ... then I still don't see how to do an encoding of weak references that > isn't invasive (e.g., adding in a user-level GC that constructors are somehow > guaranteed to go through). Fo

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-04 Thread Leo Meyerovich
On Jul 4, 2010, at 12:30 AM, Brendan Eich wrote: > On Jul 3, 2010, at 10:27 PM, Leo Meyerovich wrote: > >> Is object identity the inverse of hash? > > No, merely the missing-from-the-standard-library egal function that you can > write yourself. See > > http://wiki.ecmascript.org/doku.php?id=s

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-04 Thread Brendan Eich
On Jul 3, 2010, at 10:27 PM, Leo Meyerovich wrote: > Is object identity the inverse of hash? No, merely the missing-from-the-standard-library egal function that you can write yourself. See http://wiki.ecmascript.org/doku.php?id=strawman:egal Mark answered on Object.hashcode already. Here's the

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-04 Thread Leo Meyerovich
... and while it might be unclear from my tone, I've repeatedly hit pain points weak references, so I'm for an encoding getting in. It's a big deal for proper frameworks & DSL design. The dictionary approach was nice in that it supports weak references (a singleton collection) and provides obje

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-03 Thread Leo Meyerovich
On Jul 3, 2010, at 10:50 PM, Mark S. Miller wrote: > On Sat, Jul 3, 2010 at 10:27 PM, Leo Meyerovich wrote: > Is object identity the inverse of hash? So myObj == identity(hash(myObj))? > > No. There is not and must not be an identity function which turns data into > access. This would destroy

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-03 Thread Mark S. Miller
On Sat, Jul 3, 2010 at 10:27 PM, Leo Meyerovich wrote: > Is object identity the inverse of hash? So myObj == identity(hash(myObj))? > No. There is not and must not be an identity function which turns data into access. This would destroy the most important safety property of JavaScript, that obje

Re: es-discuss Digest, Vol 41, Issue 9

2010-07-03 Thread Leo Meyerovich
Is object identity the inverse of hash? So myObj == identity(hash(myObj))? Then weakly keyed or mapped tables are obviously possible, even though they'll have to be manually cleared of expired values. Unfortunately, while this may support encoding weak mappings, I suspect a feature like that is