On Tue, Oct 2, 2012 at 11:01 AM, Allen Wirfs-Brock <al...@wirfs-brock.com>wrote:

>
> On Oct 2, 2012, at 10:18 AM, Kevin Smith wrote:
>
>
> private @FooBrand;
>> class Foo {
>>    constructor() {
>>         /* establish the internal Fooness of the instance */
>>         this.@FooBrand = true;
>>    }
>> }
>> Foo.isFoo = function (obj) {return !!obj.@FooBrand};
>>
>
> Using this strategy, will isFoo not fail, if the specified object came
> from a different global context (frame)?
>
> Kevin
>
>
> Indeed it would, but why shouldn't it?  Foo in another  frame is a
> different class.  If you need to do cross-frame brand, that seems like an
> additional requirement would require additional mechanism.
>
> Wouldn't a WeakMap branding scheme has similar issues. You would need to
> share via some means a common WeakMap among constructors in different
> frames.  Just like to make symbol based branding work for this requirement
> you would have to share a private symbol between frames.
>
> For classes, I agree it should fail cross frame -- they are different
classes. But what about builtins? Note that ES5 [[Class]] is a cross-frame
brand for builtins. And Array.isArray is an ad-hoc one-off cross-frame
brand check.




> Allen
>
>
>


-- 
    Cheers,
    --MarkM
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to