On Oct 2, 2012, at 10:47 AM, Mark S. Miller wrote:

> Having isFoo succeed on an instance of Bar is correct. But there's another 
> case that's more worrisome:
> 
> Foo foo = new Foo();
> Baz baz = Object.create(foo);
> 
> By Allen's pattern, isFoo will also succeed on an instance of baz. OTOH, were 
> the branding done with a WeakMap or the brandcheck done with an own check....

Yes, you're correct an own property check is needed in isFoo.  That is is one 
disadvantage of use private symbols as brands rather than WeakMaps.  On the 
other hand, if you have many instances that need to be branded I suspect that 
the distributed symbol based technique is going to have a better performance 
profile than the WeakMaps.  My old GC writer self cringes at the possible perf 
impact many WeakMaps with large numbers of entries.

Allen



_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to