Draf 2 of the spec for Namespace objects. --larsTitle: The class "Namespace"
The class Namespace
FILE: spec/library/Namespace.html DRAFT STATUS: DRAFT 2 - 2008-03-17 SOURCES: REFERENCES [1], [2] REVIEWED AGAINST ES3: N/A REVIEWED AGAINST ERRATA: N/A REVIEWED AGAINST BASE DOC: YES REVIEWED AGAINST PROPOSALS: N/A REVIEWED AGAINST CODE: YES IMPLEMENTATION STATUS: ES4 RI (partly) CHANGES SINCE DRAFT 1 (2008-03-05) * Presentation: added an explicit "extends Object" clause * Namespaces are explicitly designated nullable and a null value is tied to the compatibility namespace noNS. * The behavior of the 'toString' method has been tightly specified to allow Namespace objects to be compared predictably. OPEN ISSUES * Namespace objects in ES4 are more opaque than the Namespace objects in the base document and in E4X, both of which expose "prefix" and "name" properties. ES4 is not supporting E4X, and the base document was probably influenced by E4X, so this may not be a big deal, but it should be discussed. REFERENCES [1] Section 4.2.10.4 of the base document: http://wiki.ecmascript.org/lib/exe/fetch.php?id=resources%3Aresources&cache=cache&media=resources:as3lang.doc [2] builtins/Namespace.es in the ES4 RI [3] Language definition, section on Names (forthcoming).
The class
Namespaceis a final, non-dynamic, nullable, direct subclass ofObject. It reflects a namespace as an opaque datum.NOTE Namespaces are created as a result of the evaluation of the
namespacepragma, which defines a new namespace and creates a binding for it. Namespaces are reflected asNamespaceobjects when namespace bindings are referenced in expressions.NOTE A
Namespaceobject can be created with an explicit name by providing the name as a string in thenamespacepragma.NOTE Generally a null namespace value is used to denote the compatibility namespace noNS.
COMPATIBILITY NOTE The
Namespaceclass is new in the 4th Edition of this Standard.Synopsis
The class
Namespaceprovides the following interface:__ES4__ final class Namespace extends Object { intrinsic function toString(): string }The
Namespaceprototype object provides the following direct properties:toString: function ()Operators
The operators
==and===compare as equal two non-opaqueNamespaceobjects that are separately created from the same string; similarly, the operators!=and!==compare as not equal twoNamespaceobjects that are separately created from dissimilar strings.Methods on the
Namespaceclass objectThere are no methods on the
Namespaceclass object. In particular, the classNamespacedoes not have a publicly accessible constructor.Methods on
Namespaceinstancesintrinsic::toString()
Description
The intrinsic
toStringmethod converts theNamespaceobject to a string. If theNamespaceobject was created with an explicit name then the string contains that name as a substring.Returns
The
toStringmethod returns an implementation-defined string.Suppose the intrinsic
toStringmethod is invoked on two namespaces N1 and N2 yielding strings T1 and T2, respectively. T1 and T2 are equal if and only if N1 is equal to N2 (by===or==).Suppose the intrinsic
toStringmethod is invoked on two different non-opaque namespaces N1 and N2 created from strings S1 and S2, yielding strings T1 and T2, respectively. T1 and T2 have the same relationship (determined by the relational operators) as S1 and S2.Methods on the
Namespaceprototype objectDescription
The methods on the
Namespaceprototype object delegate to their corresponding intrinsic methods.Returns
The methods on the
Namespaceprototype object return what their corresponding intrinsic methods return.Implementation
prototype function toString(this:Namespace) this.intrinsic::toString()_______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
