Must built-in prototypes also be valid instances? (Was: Why DataView.prototype object's [[Class]] is "Object"?)

Mark S. Miller erights at google.com
Sat Sep 29 22:31:59 PDT 2012


On Sat, Sep 29, 2012 at 10:21 PM, Mark S. Miller <erights at google.com> wrote:

>
> I agree that the only security issue is avoiding the communications
> channel.
>
> Security aside, given maximin
>
>     class Foo
>
> what do you suggest Foo.prototype be?
>

That was too vague. Reformulating.

Private properties, i.e., properties named by symbols, are the class analog
to the internal properties of the built ins. The current [[Class]] tests in
ES5 are there essentially to ensure that these internal properties exist
and satisfy whatever invariant is assumed. In maximin classes, we don't
expand methods with an analog of that [[Class]] check. Rather, the presence
of these private symbol-named properties implicitly provides the branding.
Say class Foo uses symbol @s to name a private instance property of
instances of Foo, and that method bar() of Foo accesses this @s property,
failing if the object doesn't have an @s. Clearly, bar() should fail on
Foo.prototype just as it should fail on any non-instance of Foo. This is
already implied by the mechanisms proposed for installing private instance
variables.

-- 
    Cheers,
    --MarkM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20120929/9102b3e2/attachment.html>


More information about the es-discuss mailing list