WeakMap better than Private Symbols? (was: direct_proxies "problem")

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Jan 10 12:14:02 PST 2013


Right,  that's not how the spec. is written.

You certainly could do that on a per instance basis by copying down the methods.  Perhaps even define yourself a subclass to do so.  But it would be silly to force this on every instance.


On Jan 10, 2013, at 12:04 PM, Domenic Denicola wrote:

> Really?? http://people.mozilla.org/~jorendorff/es6-draft.html#sec-15.15.5
> 
> From: es-discuss-bounces at mozilla.org [es-discuss-bounces at mozilla.org] on behalf of Rick Waldron [waldron.rick at gmail.com]
> Sent: Thursday, January 10, 2013 14:57
> To: Nathan Wall
> Cc: es-discuss at mozilla.org
> Subject: Re: WeakMap better than Private Symbols? (was: direct_proxies "problem")
> 
> 
> 
> 
> On Thu, Jan 10, 2013 at 11:22 AM, Nathan Wall <nathan.wall at live.com> wrote:
>     // ES6 WeakMap
> 
>     let timeMap = new WeakMap(),
>         // Store WeakMap methods to maintain integrity of the internal state.
>         WeakMapGet = Function.prototype.call.bind(WeakMap.prototype.get),
>         WeakMapSet = Function.prototype.call.bind(WeakMap.prototype.set);
> 
> 
> Just a heads up, this is unnecessary and actually won't work at all. WeakMap has nothing defined on its prototype property—all methods are late-bound to the instance for the same reason you mention in the comment. https://gist.github.com/4505255
> 
> Rick
> 
> _______________________________________________
> es-discuss mailing list
> es-discuss at mozilla.org
> https://mail.mozilla.org/listinfo/es-discuss

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20130110/2d01541a/attachment.html>


More information about the es-discuss mailing list