Re: Question regarding ES5

2011-02-17 Thread Dmitry A. Soshnikov
Very strange behavior. What's the rationale? To avoid a shadowing? To avoid typo-errors -- i.e. if a user uses assignment it may be occasionally and if he uses Object.defineProperty -- he really wants to do it? Looks inconsistently. Assignment always affected an own property (only if the

Question regarding ES5

2011-02-16 Thread Irakli Gozalishvili
Hi, I've run into one issue and even after reading ES5 specs several times it's not clear to me what should be an expected behavior: Currently on Firefox nightly following code: (function() { use strict; function Type() {} Object.freeze(Type.prototype); var object =

Re: Question regarding ES5

2011-02-16 Thread Allen Wirfs-Brock
The error looks correct to me. By freezing Type.proto you make all its own properties read only. One of those is the constructor that is automatically created on every func.prototype object. When you assign to object.constructor you are trying to over-ride an inherited read-onoy property.

Re: Question regarding ES5

2011-02-16 Thread Irakli Gozalishvili
Thanks for the reply Allen, I was under the impression that inherited properties can be overridden, regardless of their write-ability on the __proto__. Also as far as I understand freeze will make properties including constructor non-confugurable, will I still be able to override such

Re: Question regarding ES5

2011-02-16 Thread Irakli Gozalishvili
I have not found a way to cc people but here is the link for a bug report: http://code.google.com/p/v8/issues/detail?id=1169 I think if you'll star it you'll get an updates over email. Regards -- Irakli Gozalishvili Web: http://www.jeditoolkit.com/ Address: 29 Rue Saint-Georges, 75009 Paris,

Re: Question regarding ES5

2011-02-16 Thread Allen Wirfs-Brock
They can be over-ridden by Object.defineOwnProperty. they cannot be over-ridden by assignment. See ES5 [[CanPut]] specification 8.12.4. step 8.b On Feb 16, 2011, at 5:32 PM, Irakli Gozalishvili wrote: Thanks for the reply Allen, I was under the impression that inherited properties can be

Re: Question regarding ES5

2011-02-16 Thread Jeff Walden
On 02/16/2011 05:32 PM, Irakli Gozalishvili wrote: I was under the impression that inherited properties can be overridden, regardless of their write-ability on the __proto__. Here's another take on this -- same idea, just another statement of it. You can override any inherited property. You

Re: Question regarding ES5

2011-02-16 Thread Oliver Hunt
This behaviour seems to result in undesirable behaviour in conjunction with object literals: Object.defineProperty(Object.prototype, foo, {value:bar}); use strict; var someObject = {foo:wibble} Will now throw. --Oliver On Feb 16, 2011, at 6:02 PM, Allen Wirfs-Brock wrote: They can be

Re: Question regarding ES5

2011-02-16 Thread Mark S. Miller
On Wed, Feb 16, 2011 at 8:07 PM, Oliver Hunt oli...@apple.com wrote: This behaviour seems to result in undesirable behaviour in conjunction with object literals: Object.defineProperty(Object.prototype, foo, {value:bar}); use strict; var someObject = {foo:wibble} Will now throw. It