From: Asen Bozhilov on 22 Mar 2010 05:47 Garrett Smith wrote: > | A host object is an object supplied by the host environment to > | complete the execution environment of ECMAScript. > | > | Examples of Host objects: `document`, `XMLHttpRequest`, and `alert`. "Host objects aren't specified by ECMA-262 standard. They are specifics for different environments. Each ECMA-262 implementation can provide additional objects. If any of these objects aren't specified by ECMA-262, it's a host object."
From: kangax on 22 Mar 2010 09:27 On 3/22/10 5:47 AM, Asen Bozhilov wrote: > Garrett Smith wrote: > >> | A host object is an object supplied by the host environment to >> | complete the execution environment of ECMAScript. >> | >> | Examples of Host objects: `document`, `XMLHttpRequest`, and `alert`. > > "Host objects aren't specified by ECMA-262 standard. They are > specifics for different environments. Each ECMA-262 implementation can > provide additional objects. If any of these objects aren't specified ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > by ECMA-262, it's a host object." ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ As I understand it, this isn't necessarily so. But specs are vague on this one. Note how 4.3.7 (in ES3) says: "A built-in object is any object supplied by an ECMAScript implementation, independent of the host environment, which is present at the start of the execution of an ECMAScript program. Standard built-in objects are defined in this specification, and an ECMAScript implementation may specify and define others. Every built-in object is ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ a native object." So implementation may define other built-in (and so native) objects. 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. 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. -- kangax
From: Thomas 'PointedEars' Lahn on 22 Mar 2010 09:50 Peter Michaux wrote: > On Mar 20, 6:00 pm, "FAQ server" <javascr...(a)dotinternet.be> wrote: >> ----------------------------------------------------------------------- >> FAQ Topic - What are object models? >> ----------------------------------------------------------------------- >> >> Object models (OMs) are not part of the ECMAScript language; they >> are provided by the host to allow javascript (or other scripting >> language) to communicate with the host. An object model may allow >> javascript to access a file system (Mac, Windows, and Linux are all >> scriptable). The most common of all is the Document Object Model (DOM). >> Other document types such as SVG also define scriptable DOMs, >> mostly as extensions of the W3C Core DOM specification designed for use >> with XML documents. > > 1) This is not a frequently asked question. ACK > 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. > 3) Completely within ECMAScript, I can create my own set of objects > that models a community of people. So object models are implicit in > ECMAScript. Very true. Object model is an abstract concept. A document object model, for example, is a less abstract application of that concept, the W3C DOM API is a formal specification of it, and the DOM of a Web browser is an implementation of ([some of] the interfaces of) that specification. > I think this FAQ entry should be removed. Either that or considerably reworded. PointedEars -- Danny Goodman's books are out of date and teach practices that are positively harmful for cross-browser scripting. -- Richard Cornford, cljs, <cife6q$253$1$8300dec7(a)news.demon.co.uk> (2004)
From: Thomas 'PointedEars' Lahn on 22 Mar 2010 10:12 kangax wrote: > On 3/22/10 5:47 AM, Asen Bozhilov wrote: >> Garrett Smith wrote: >>> | A host object is an object supplied by the host environment to >>> | complete the execution environment of ECMAScript. >>> | >>> | Examples of Host objects: `document`, `XMLHttpRequest`, and `alert`. >> >> "Host objects aren't specified by ECMA-262 standard. They are >> specifics for different environments. Each ECMA-262 implementation can >> provide additional objects. If any of these objects aren't specified > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ >> by ECMA-262, it's a host object." > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > > As I understand it, this isn't necessarily so. You understand correctly. One must distinguish between the ECMAScript Specification, its implementations, and the specific implementation's host environment, and standard built-in native, built-in native, and host objects, respectively. (User-defined native objects are defined on top of that.) > But specs are vague on this one. I don't think so. > Note how 4.3.7 (in ES3) says: > > "A built-in object is any object supplied by an ECMAScript > implementation, independent of the host environment, which is present at > the start of the execution of an ECMAScript program. Standard built-in > objects are defined in this specification, and an ECMAScript > implementation may specify and define others. Every built-in object is > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > a native object." > > So implementation may define other built-in (and so native) objects. ACK > 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. And there are. Examples include `Enumerator' in JScript 3.0+, and `Iterator' in JavaScript 1.7+. (Some even say `XMLHttpRequest' would be native in JScript 5.7.x, but I find that questionable as it uses the same interface as the host ActiveX/COM object, and might not be present, e.g. in JScript.NET in ASP. Details anyone?) > 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. Not quite. If an implementation defines an object (and not the user of the implementation, i.e. the developer), it is a built-in native object. If the host environment provides the object, it is a host object. If the developer *defines* the object, it is a only a native object. (But developers may also *create* new host objects through other host objects; example: document.createElement()). PointedEars -- Use any version of Microsoft Frontpage to create your site. (This won't prevent people from viewing your source, but no one will want to steal it.) -- from <http://www.vortex-webdesign.com/help/hidesource.htm> (404-comp.)
From: Peter Michaux on 22 Mar 2010 10:50
On Mar 22, 7:50 am, Thomas 'PointedEars' Lahn <PointedE...(a)web.de> 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". Peter |