From: Asen Bozhilov on 22 Mar 2010 10:50 kangax wrote: > 4.3.6 also says: > > "A native object is any object supplied by an ECMAScript implementation > independent of the host environment. Standard native objects are > ^^^^^^^^^^^^^^^^^^^^^^^ > defined in this specification." > > ...implying that there could be other (not "standard") native objects. If it's non standard "native" object will be a host object: | ECMA-262-3 | 4.3.8 Host Object | A host object is any object supplied by the host environment | to complete the execution environment of | ECMAScript. Any object that is not native is a host object. ES5 has better definition of native objects: | ECMA-262-5 | 4.3.6 | native object | object in an ECMAScript implementation whose semantics are | fully defined by this specification rather than by | the host environment. > So if implementation defines, say, global `Foo` object, it may be native > (built-in or not, depending on whether it's present at the start of > Program execution) or host one. `Foo` is only name binding. `Foo` can refer both native or host object. If `Foo` refer object, which semantic is defined by ECMA-262 standard that mean, `Foo` refer native object.
From: Thomas 'PointedEars' Lahn on 22 Mar 2010 11:06 Peter Michaux wrote: > Thomas 'PointedEars' Lahn wrote: >> Peter Michaux wrote: >> > 2) Object models are an orthogonal concept to host objects. >> >> Maybe I am misunderstanding "orthogonal" as "contradictory" here, >> but host objects are actually *part* of some object models. > > By "orthogonal" I mean something along the lines of "independently > varying". ACK, thanks. PointedEars -- realism: HTML 4.01 Strict evangelism: XHTML 1.0 Strict madness: XHTML 1.1 as application/xhtml+xml -- Bjoern Hoehrmann
From: kangax on 22 Mar 2010 11:18 On 3/22/10 10:50 AM, Asen Bozhilov wrote: > kangax wrote: > >> 4.3.6 also says: >> >> "A native object is any object supplied by an ECMAScript implementation >> independent of the host environment. Standard native objects are >> ^^^^^^^^^^^^^^^^^^^^^^^ >> defined in this specification." >> >> ...implying that there could be other (not "standard") native objects. > > If it's non standard "native" object will be a host object: > > | ECMA-262-3 > | 4.3.8 Host Object > | A host object is any object supplied by the host environment > | to complete the execution environment of > | ECMAScript. Any object that is not native is a host object. Yes, if it's not native it's host object. But if it's not native *standard*, it could just be native *non-standard*; i.e. it's provided by implementation (not host environment), but is not part of ECMA-262 specification. > > ES5 has better definition of native objects: > > | ECMA-262-5 > | 4.3.6 > | native object > | object in an ECMAScript implementation whose semantics are > | fully defined by this specification rather than by > | the host environment. That's why I mentioned vagueness. Specs seem to be confused on the distinction of host objects and native non-standard objects. > >> So if implementation defines, say, global `Foo` object, it may be native >> (built-in or not, depending on whether it's present at the start of >> Program execution) or host one. > > `Foo` is only name binding. Of course. > `Foo` can refer both native or host object. Yep. > If `Foo` refer object, which semantic is defined by ECMA-262 > standard that mean, `Foo` refer native object. So you say that object referenced originally by `Array.prototype.forEach` (which is not defined in ECMA-262, but is present in, say, Mozilla's Spidermonkey implementation) is a host object? -- kangax
From: Asen Bozhilov on 22 Mar 2010 11:30 kangax wrote: > So you say that object referenced originally by > `Array.prototype.forEach` (which is not defined in ECMA-262, but is > present in, say, Mozilla's Spidermonkey implementation) is a host object? Again, `forEach' is name binding. `forEach' property refer native object, which semantic is defined by ECMA-262 standard. Same case you can observe with `String.prototype.substr`, which refer native object. Enumerator, Iterator and so on, aren't non standard native objects. Their semantic is fully defined by ECMA-262 standard and they are simply native objects. If they don't follow semantic defined by specification, they are host objects.
From: Thomas 'PointedEars' Lahn on 22 Mar 2010 11:41
kangax wrote: > On 3/22/10 10:50 AM, Asen Bozhilov wrote: >> ES5 has better definition of native objects: >> >> | ECMA-262-5 >> | 4.3.6 >> | native object >> | object in an ECMAScript implementation whose semantics are >> | fully defined by this specification rather than by >> | the host environment. > > That's why I mentioned vagueness. Specs seem to be confused on the > distinction of host objects and native non-standard objects. Yes, they botched this one. On the other hand, the key words here might be "semantics ... fully defined". >> If `Foo` refer object, which semantic is defined by ECMA-262 >> standard that mean, `Foo` refer native object. > > So you say that object referenced originally by > `Array.prototype.forEach` (which is not defined in ECMA-262, but is > present in, say, Mozilla's Spidermonkey implementation) is a host object? If so, IMNSHO that could not be farther from the truth. With regard to Mozilla, it is pretty simple (I think): If it is defined in JavaScript, it is a native object (even if it is a standards-compliant extension of ECMAScript, like forEach()); if it is defined for the Gecko DOM instead, it is/refers to a host object (like `document'). PointedEars -- Prototype.js was written by people who don't know javascript for people who don't know javascript. People who don't know javascript are not the best source of advice on designing systems that use javascript. -- Richard Cornford, cljs, <f806at$ail$1$8300dec7(a)news.demon.co.uk> |