The way too handle readonly properties in the prototype.

Brendan Eich brendan at mozilla.com
Sat Sep 17 10:42:51 PDT 2011


On Sep 17, 2011, at 1:14 PM, Xavier MONTILLET wrote:

> function Constructor( ) { }
> Object.defineProperty( Constructor.prototype, 'property', {
>    value: 'prototype'
> } );

NB: writable is undefined in that property descriptor, and undefined is falsy.


> var object = new Constructor( );
> object.property = 'instance';
> console.log( object.property );// 'instance'

No, 'prototype' in a conforming implementation (tested in SpiderMonkey shell and Firefox).

You're re-discovering a v8 bug that I believe is already reported, possibly even fixed. The ES5.1 spec is clear on this.

/be
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20110917/ee92a007/attachment.html>


More information about the es-discuss mailing list