Finiteness of object properties set
Jason Orendorff
jason.orendorff at gmail.com
Mon Sep 19 00:32:39 PDT 2011
On Tue, Sep 6, 2011 at 10:59 AM, Mark S. Miller <erights at google.com> wrote:
> [...] Regarding infinite extensible
> objects, the only problem I see off the top of my head is: What would
> Object.getOwnPropertyNames return?
Hmm. I wonder if this is a problem even for finite objects.
js> var x = [];
js> x = Object.getOwnPropertyNames(x);
["length"]
js> x = Object.getOwnPropertyNames(x);
["length", "0"]
js> x = Object.getOwnPropertyNames(x);
["length", "0", "1"]
js> x = Object.getOwnPropertyNames(x);
["length", "0", "1", "2"]
You see where this is going. There's a finite number of array indexes,
and the array .length property is always less than 2^32.
Of course on current machines we will eventually run out of time or
memory, but what is supposed to happen when we cross 2^32?
-j
More information about the es-discuss
mailing list