WeakMap API questions?
mike.shaver at gmail.com
Thu Sep 2 09:19:51 PDT 2010
On Thu, Sep 2, 2010 at 12:46 AM, Erik Corry <erik.corry at gmail.com> wrote:
> And this is as it should be. As it stands the weak map can be used as
> an object with private members. The object key acts as a capability
> that controls whether or not you have access to the private member.
If I were to be using an object with private members, I would
certainly expect that those members would keep their values alive.
Wouldn't it be better to just use a regular object, and add private
members via defineProperty to make them non-enumerable?
I'm not in favour of WeakMap enumerability, really, but it seems that
there's an easier way to address this particular use case.
More information about the es-discuss