On Mon, Sep 19, 2016 at 7:32 AM, Park Hyeonu <nemo1...@gmail.com> wrote:
> I'm sure this feature is already implemented for every modern js engines, > as it's needed to implement Map/Set. > But you know that, it's indeterministic and implementation is free to reorganize pointers? a = {}; b = {}; Object.compare(a,b); // 1 gc.enforceGC(); Object.compare(a,b); // -1 So any userland structure can't rely on persistence of order. Moreover, such ordering can be implemented with WeakMap. const wm = new WeakMap() let i = 0; function getId(obj) { if (!wm.has(obj)) wm.set(obj, i++); return wm.get(obj); }
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss