On Dec 2, 2013, at 10:53 AM, Geoffrey Garen <[email protected]> wrote:
> Hi Alexei. > >> To my knowledge, an object's prototype is consulted when a property is not >> found on the object itself. Any new property is written to the object, never >> its prototype. > > That’s not quite right. The prototype chain is consulted when assigning a new > property, if the prototype has a property of that name. Actually that statement is true – any newly created property will only ever be on the object, never its prototype. >> So I was expecting to add the "ctor" property on "newClassObj" directly and >> shadow the prototype's read-only "ctor", but it seems that either the >> property is set on the object's prototype (and the ReadOnly attribute makes >> it a no-op) or the ReadOnly attribute contaminates the object itself. The prototype chain is consulted, and presence of a read only property will cause assignment to fail. Default is to fail silently, but if you use strict mode you’ll get an exception. If you want to create a shadowing property on the object you can do so via Object.defineProperty. cheers, G. > Geoff > _______________________________________________ > webkit-dev mailing list > [email protected] > https://lists.webkit.org/mailman/listinfo/webkit-dev _______________________________________________ webkit-dev mailing list [email protected] https://lists.webkit.org/mailman/listinfo/webkit-dev

