On Sep 3, 2011, at 11:59 AM, Thomas L. Shinnick wrote:

> An issue popped up where V8 recently made everything in Error objects 
> non-enumerable.  This was surprising to some apps.  More surprising is the 
> insistence that this is required by the ES5 spec.
> 
> As a simplistic reader, when "own property" is mentioned here
> 
>    15.11.2.1 new Error (message)
> 
>    If the argument message is not undefined, the message own property
>    of the newly constructed object is set to ToString(message).

This isn't the clearest possible language but it is clear enough when read in 
conjunction with the last paragraph of the introduction to section 15 which 
says: "Every other property described in this clause has the attributes { 
[[Writable]]: true, [[Enumerable]]: false, [[Configurable]]: true } unless 
otherwise specified".  Language, with the same effect also existed in the ES3 
spec.

> 
> I just naturally think this property it is not supposed to be mysteriously 
> unseen.  Yet other general statements in the spec have people think 
> everything not explicitly labeled enumerable _can't_ be.
> 
>  http://code.google.com/p/v8/issues/detail?id=1215    "But the spec is the 
> spec"

Which it is.  The exception is if the spec. differs from what has historically 
been interoperably implemented by browsers.  If most cases if the spec. differs 
from that then it is probably wrong. Standards such as the ES spec. exist to 
make sure that all implementations behave the same.  Sometimes, not everybody 
will like the standardized behavior but the important thing is that it is the 
same across all implementations 

>  http://code.google.com/p/v8/issues/detail?id=1595    "...this consequence 
> may have been unintended."
> 
> Does the ES5 spec intend for 'message' property of Error objects to be 
> non-enumerable?

That's what it says and that's what you should implement unless you can 
demonstrate that doing so creates creates a new interoperability problem.

Allen
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to