<div dir="ltr">Thank you very much. I&#39;ve found both your hints about &quot;use strict&quot; and Object.defineProperty very useful.</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Dec 2, 2013 at 9:29 PM, Gavin Barraclough <span dir="ltr">&lt;<a href="mailto:barraclough@apple.com" target="_blank">barraclough@apple.com</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><br>
On Dec 2, 2013, at 10:53 AM, Geoffrey Garen &lt;<a href="mailto:ggaren@apple.com">ggaren@apple.com</a>&gt; wrote:<br>
<br>
&gt; Hi Alexei.<br>
&gt;<br>
&gt;&gt; To my knowledge, an object&#39;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.<br>
&gt;<br>
&gt; That’s not quite right. The prototype chain is consulted when assigning a new property, if the prototype has a property of that name.<br>
<br>
</div></div>Actually that statement is true – any newly created property will only ever be on the object, never its prototype.<br>
<div class="im"><br>
&gt;&gt; So I was expecting to add the &quot;ctor&quot; property on &quot;newClassObj&quot; directly and shadow the prototype&#39;s read-only &quot;ctor&quot;, but it seems that either the property is set on the object&#39;s prototype (and the ReadOnly attribute makes it a no-op) or the ReadOnly attribute contaminates the object itself.<br>


<br>
</div>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.<br>
<br>
If you want to create a shadowing property on the object you can do so via Object.defineProperty.<br>
<br>
cheers,<br>
G.<br>
<br>
<br>
&gt; Geoff<br>
&gt; _______________________________________________<br>
&gt; webkit-dev mailing list<br>
&gt; <a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>
&gt; <a href="https://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank">https://lists.webkit.org/mailman/listinfo/webkit-dev</a><br>
<br>
</blockquote></div><br><br clear="all"><div><br></div>-- <br>Best regards<br>Alexei Sholik
</div>