On 29 October 2014 02:48, Isiah Meadows impinb...@gmail.com wrote:
I'm proposing simply initializing a new instance and GC'ing the old
instance entirely (updating the `this` to point to the new) instead of
the current algorithm of maintaining a list of keys. I know that it
potentially slow
I'm proposing simply initializing a new instance and GC'ing the old
instance entirely (updating the `this` to point to the new) instead of
the current algorithm of maintaining a list of keys. I know that it
potentially slow down the method itself, but it could eliminate the
need for keeping a
Nice idea, but there seems to be (some) complications.
Set **this** to *T*.
What is `this` specifically? As far as I can see, it is a value and not a
reference. And even if it were a reference, setting it to point to another
object does not affect the other references which point to the old
What I mean is, consider this code:
```js
var wsRef = new WeakSet();
var wsRef2 = wsRef;
wsRef.clear();
```
As far as I can see, in the `wsRef.clear()` algorithm, the `this` value has
no relation with the `wsRef` identifier. Even if there was some internal
magic around changing the identifier's
On Oct 28, 2014 10:18 PM, Fabrício Matté ultco...@gmail.com wrote:
What I mean is, consider this code:
```js
var wsRef = new WeakSet();
var wsRef2 = wsRef;
wsRef.clear();
```
As far as I can see, in the `wsRef.clear()` algorithm, the `this` value
has no relation with the `wsRef`
My client needs to not glitch on me... :(
On Oct 28, 2014 10:25 PM, Isiah Meadows impinb...@gmail.com wrote:
On Oct 28, 2014 10:18 PM, Fabrício Matté ultco...@gmail.com wrote:
What I mean is, consider this code:
```js
var wsRef = new WeakSet();
var wsRef2 = wsRef;
wsRef.clear();
Not in pure ECMAScript being interpreted, but it can definitely be done
in the implementation.
Yeah I think so too, but if no where else in the specification uses this
pattern, implementations would be required to implement new mechanisms and
possibly have de-optimizations.
Actually, the de-opts shouldn't exist, considering it's effective
equivalent in C++ would be pretty straightforward (and could be polyfilled
in Node literally via native code):
```cpp
HandleJSWeakMap* createClearedInstance() {
// ...
}
// ...
HandleJSWeakMap* wm-inst =
On Tue, Oct 28, 2014 at 10:58 PM, Fabrício Matté ultco...@gmail.com wrote:
Looks nice, then. `;)` Though, this may not be so easy to implement in other
languages which don't provide direct access to memory addresses, affecting
implementations such as Rhino which is written in Java.
Nit: Object
I'm bumping the initial link: https://github.com/impinball/weakmap-weakset-clear
___
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss
can see, this seems a lot more complicated than it is worth,
and it would at least require a new abstract operation for internally
in-place replacing objects while keeping references intact.
Wouldn't it be far easier to just have an internal data property in each
Weak(Map|Set) which can
I mostly have a similar approach in mind for tail calls. Precise about the
interface, imprecise/informative about the implementation requirements. For
WeakMaps, that means a well-defined API with informal English describing the
expectations about memory consumption. For tail calls, it means a
On Fri, Oct 7, 2011 at 5:23 PM, David Herman dher...@mozilla.com wrote:
I mostly have a similar approach in mind for tail calls. Precise about the
interface, imprecise/informative about the implementation requirements. For
WeakMaps, that means a well-defined API with informal English
Le 15/09/2011 17:47, Allen Wirfs-Brock a écrit :
On Sep 15, 2011, at 6:49 AM, Andreas Rossberg wrote:
On 15 September 2011 09:10, Brendan Eichbren...@mozilla.com wrote:
On Sep 14, 2011, at 11:09 PM, Allen Wirfs-Brock wrote:
I would prefer ObjectMap (the keys are restricted to objects).
On 16 September 2011 13:52, David Bruant david.bru...@labri.fr wrote:
Furthermore, let imagine for a minute that i need an ECMAScript
implementation for programs i write which i know (for some reason) all are
short live and use a maximum finite amount of memory i know. Based on this
knowledge
Le 16/09/2011 14:14, Andreas Rossberg a écrit :
On 16 September 2011 13:52, David Bruantdavid.bru...@labri.fr wrote:
Furthermore, let imagine for a minute that i need an ECMAScript
implementation for programs i write which i know (for some reason) all are
short live and use a maximum finite
[Forgot the list.]
-- Forwarded message --
From: Andreas Rossberg rossb...@google.com
Date: 16 September 2011 15:35
Subject: Re: {Weak|}{Map|Set}
To: David Bruant david.bru...@labri.fr
On 16 September 2011 15:17, David Bruant david.bru...@labri.fr wrote:
Well yes, but that's
Changing the subject to something more relavant.
Le 16/09/2011 15:36, Andreas Rossberg a écrit :
On 16 September 2011 15:17, David Bruantdavid.bru...@labri.fr wrote:
Well yes, but that's part of programming. In practice, all resources
are finite. And the difference between finite and infinite
On Thu, Sep 15, 2011 at 10:56 AM, Kyle Simpson get...@gmail.com wrote:
If I was a programmer
looking for something like weak referencing in JS for the first time,
weak is what I'd be searching for.
But if you're actually aware of weakrefs (as I am), and you're searching
for them in JS (as
On Fri, Sep 16, 2011 at 10:14 AM, Rick Waldron waldron.r...@gmail.comwrote:
On Thu, Sep 15, 2011 at 10:56 AM, Kyle Simpson get...@gmail.com wrote:
[...] WeakMap [...] That's a failed conclusion, because only the keyrefs
are weak.
I can second this _exact_ experience.
[...]
Does anyone
On Fri, Sep 16, 2011 at 10:41 AM, Allen Wirfs-Brock
al...@wirfs-brock.comwrote:
[...]
This is the exact situation that exists for any ECMAScript dynamic
allocation. There are no guarantees in the ES spec. that resources
allocated with an inaccessible object will be freed in a timely manner
On 16 September 2011 19:42, Mark S. Miller erig...@google.com wrote:
Does anyone see anything wrong with EphemeralMap?
Yes. It's a longish name, and one that I will never be able to
remember how to spell correctly. And to most programmers it probably
sounds about as reassuring as endofunctor or
I think we are digressing. There are three separate questions:
1. Intent
2. Specification
3. Testing
Sometimes the intent is hard or impossible to specify formally,
sometimes a specification is hard or impossible to test for. That
doesn't necessarily invalidate such an intent or such a
On Sep 16, 2011, at 5:14 AM, Andreas Rossberg wrote:
...
Consider writing a server. If I cannot rely on tail call optimization
then writing its message loop as a recursive function (e.g. actors
style) would be incorrect. If I cannot rely on GC, then allocating an
object for each received
On Sep 16, 2011, at 10:52 AM, Mark S. Miller wrote:
On Fri, Sep 16, 2011 at 10:41 AM, Allen Wirfs-Brock al...@wirfs-brock.com
wrote:
[...]
This is the exact situation that exists for any ECMAScript dynamic
allocation. There are no guarantees in the ES spec. that resources allocated
On Fri, Sep 16, 2011 at 12:41 PM, Allen Wirfs-Brock
al...@wirfs-brock.comwrote:
[...]
This all sounds reasonable but I don't see how it particularly impacts the
actual specification.
The spec has multiple customers. I agree it doesn't change the spec's
normative requirements on implementors.
On Fri, Sep 16, 2011 at 3:13 PM, Allen Wirfs-Brock al...@wirfs-brock.comwrote:
I'm not sure exactly how we are going to specify tail calls. I know that
Dave Herman has ideas that I assume we will build upon .
For weak maps I think that a non-normative note that make explicit the
doesn't
On Sep 14, 2011, at 9:42 PM, Kyle Simpson wrote:
I too have been confused by the name weakmap...partially because the name
is misleading, and partially because documentation on it is
ambiguous/misleading. Specifically, weakmap really means weakkeymap,
because only the key is weak, not the
(this).delete(key); } // todo: iteration }
From: Kam Kasravi kamkasr...@yahoo.com
To: Mark S. Miller erig...@google.com
Cc: es-discuss es-discuss@mozilla.org
Sent: Wednesday, September 14, 2011 7:53 PM
Subject: Re: {Weak|}{Map|Set}
I noticed that these class
On Wed, Sep 14, 2011 at 11:47 PM, Kam Kasravi kamkasr...@yahoo.com wrote:
The reference to private is actually in the Map, Set classes shown below.
Hi Kam,
You're correct. Fixed now. Thanks for pointing it out.
--
Cheers,
--MarkM
___
On Sep 14, 2011, at 11:09 PM, Allen Wirfs-Brock wrote:
I would prefer ObjectMap (the keys are restricted to objects).
Now that you point it out (again), I agree.
People who know a bit about GC also confuse WeakMap with WeakRef/WeakPtr, which
we have only in the strawman space:
On 15 September 2011 09:10, Brendan Eich bren...@mozilla.com wrote:
On Sep 14, 2011, at 11:09 PM, Allen Wirfs-Brock wrote:
I would prefer ObjectMap (the keys are restricted to objects).
Now that you point it out (again), I agree.
I don't. :) It is true to some extent that WeakMap is GC
If I was a programmer
looking for something like weak referencing in JS for the first time,
weak is what I'd be searching for.
But if you're actually aware of weakrefs (as I am), and you're searching for
them in JS (as I was), and you see WeakMap (as I did), and you make the
conclusion that
Why constrain WeakMap to object keys, but not Map and Set ? I think
it is because Weak only makes sense for object keys. However, if we
base the distinction on iterability rather than weakness as David
suggested, then we do not have to include an object key constraint
anywhere. We could have:
Hi Kyle,
It would be great if we found a name that suggested the full meaning of the
abstraction by itself. WeakMap is certainly not that. Sometimes we find
something like this. Also important is one that avoids suggesting any
misunderstandings. I agree that ObjectMap beats WeakMap on those
On Sep 15, 2011, at 6:49 AM, Andreas Rossberg wrote:
On 15 September 2011 09:10, Brendan Eich bren...@mozilla.com wrote:
On Sep 14, 2011, at 11:09 PM, Allen Wirfs-Brock wrote:
I would prefer ObjectMap (the keys are restricted to objects).
Now that you point it out (again), I agree.
I
On Thu, Sep 15, 2011 at 8:41 AM, Sean Eagan seaneag...@gmail.com wrote:
Why constrain WeakMap to object keys, but not Map and Set ? I think
it is because Weak only makes sense for object keys. However, if we
base the distinction on iterability rather than weakness as David
suggested, then
On Thu, Sep 15, 2011 at 8:47 AM, Allen Wirfs-Brock al...@wirfs-brock.comwrote:
[...]
No the normal use case for WeakMaps is simply to make associations between
objects and arbitrary values. The special GC behavior is necessary to avoid
memory leaks, but that is a quality of implementation
On Thu, Sep 15, 2011 at 8:41 AM, Sean Eagan seaneag...@gmail.com wrote:
Also, for the iteration API of Map (i.e. IterableMap) and Set (i.e.
IterableSet), why not integrate with iterators [1] :
let m = new Map, s = new Set;
...
for(i of m.iterator()) {
...
}
for(i of s.iterator()) {
On 15 September 2011 17:47, Allen Wirfs-Brock al...@wirfs-brock.com wrote:
No the normal use case for WeakMaps is simply to make associations between
objects and arbitrary values. The special GC behavior is necessary to avoid
memory leaks, but that is a quality of implementation issue, not a
You say and you're searching for them in JS (as I was). Had the
abstraction been called ObjectMap or ObjectRegistry, would you have found
it?
I don't think the API name is the only way someone can discover what they're
looking for. Proper documentation for ObjectMap which said keyrefs are
On Sep 15, 2011, at 9:07 AM, Mark S. Miller wrote:
On Thu, Sep 15, 2011 at 8:47 AM, Allen Wirfs-Brock al...@wirfs-brock.com
wrote:
[...]
No the normal use case for WeakMaps is simply to make associations between
objects and arbitrary values. The special GC behavior is necessary to avoid
Hi,
I have come across use cases where i didn't need a Weak/Map/, but rather
a Weak/Set/ which is that I didn't need to set a value. Usually, i set
true but feel like I'm doing something useless. The API I actually
need is:
* .add(obj) (add an element to the set which is one in WeakMaps with
On Wednesday, September 14, 2011, David Bruant david.bru...@labri.fr
wrote:
Also, I would like to talk a little bit about terminology. WeakMaps have
their name inspired by the idea of weak references which have
particular garbage-collection properties. From the developer
perspective, this
On Wed, Sep 14, 2011 at 6:04 PM, Juan Ignacio Dopazo
dopazo.j...@gmail.comwrote:
On Wednesday, September 14, 2011, David Bruant david.bru...@labri.fr
wrote:
Also, I would like to talk a little bit about terminology. WeakMaps have
their name inspired by the idea of weak references which have
I noticed that these class definitions declare private names within the class
body but not the constructor. My latest read of the class proposal was that
private could only be declared within the constructor. Have I interpreted the
BNF incorrectly?
On Sep 14, 2011, at 6:20 PM, Mark S. Miller
I too have been confused by the name "weakmap"...partially because the name is misleading, and partially because documentation on it is ambiguous/misleading. Specifically, "weakmap" really means "weakkeymap", because only the key is weak, not the value. But then again, "weakkeymap" would be even
47 matches
Mail list logo