Last call for comments. --larsTitle: The class "Name"
The class Name
NAME: "The class 'Name'" FILE: spec/library/Name.html CATEGORY: Pre-defined classes SOURCES: REFERENCES [1], [2] SPEC AUTHOR: Lars DRAFT STATUS: LAST CALL - 2008-03-20 REVIEWED AGAINST ES3: N/A REVIEWED AGAINST ERRATA: N/A REVIEWED AGAINST BASE DOC: N/A REVIEWED AGAINST PROPOSALS: YES REVIEWED AGAINST CODE: YES REVIEWED AGAINST TICKETS: YES IMPLEMENTATION STATUS: ES4 RI TEST CASE STATUS: ? CHANGES SINCE DRAFT 3 (2008-03-17) * None CHANGES SINCE DRAFT 2 (2008-03-10) * Name is now a subclass of 'Object' (not of 'String') * The 'valueOf' method has been removed; 'Name' inherits the method from the class 'Object' * The constructor interface spec has been broken up into one and two argument cases, for the sake of clarity. CHANGES SINCE DRAFT 1 (2008-03-05) * Compatibility note in intro. * More elaborate status block above. * Prototype and intrinsic methods forward to private methods now. * The Name constructor is allowed to hash-cons. * The Name converter is required to return its first argument if it is a Name object and the second parameter is undefined. NOTES * Due to an RI bug (#368), the namespace 'Private' is used instead of 'private'. REFERENCES [1] http://wiki.ecmascript.org/doku.php?id=proposals:name_objects [2] builtins/Name.es in the ES4 RI
The class
Nameis a final, nullable, non-dynamic, direct subclass ofObjectthat reflects a property name as a pair ofNamespaceandstringvalues.COMPATIBILITY NOTE The
Namespaceclass is new in the 4th Edition of this Standard.Synopsis
The class
Nameprovides the following interface:__ES4__ final class Name extends Object { public function Name(...args) static meta function invoke(...args): Name static public const length = 2 override intrinsic function toString() : string public const qualifier: Namespace public const identifier: string }The
Nameprototype object provides the following direct properties:toString: function (this: Name)Operators
The operators
==and===compare as equal twoNameobjects that are separately created from the same (qualifier,identifier) pair; similarly, the operators!=and!==compare as not equal twoNameobjects that are separately created from (qualifier,identifier) pairs.Methods on the
Nameclass objectnew Name ( id )
Returns
When the
Nameconstructor is called with one argument id it returns aNameobject whosequalifieris null and whoseidentifieris id converted tostring.Implementation
public function Name( id )new Name( ns, id )
Returns
When the
Nameconstructor is called with two arguments ns and id it returns aNameobject whosequalifieris ns and whoseidentifieris id converted tostring.ns may be null.
Implementation
public function Name( ns: Namespace?, id )Name ( ...args )
Description
The
Nameclass object called as a function creates aNameobject by invoking theNameconstructor on its argument(s).Returns
The
Nameclass object called as a function returns aNameobject.Implementation
static meta function invoke( ...args ): Name! new Name(...args);Methods on
Nameinstancesintrinsic::toString ( )
Description
The intrinsic
toStringmethod converts thisNameobject to a string.Returns
The intrinsic
toStringmethod returns a string.Implementation
override intrinsic function toString() : string Private::toString();Private function toString() : string { if (qualifier === null) return identifier; return string(qualifier) + "::" + identifier; }Value properties of
Nameinstancesqualifier
The
qualifierproperty holds the namespace value for thisNameobject. Ifqualifieris null then the implied namespace is the compatibility namespace noNS.identifier
The
identifierproperty holds the identifier value for thisNameobject. It is never null.Methods on the
Nameprototype objectDescription
The methods on the
Nameprototype object perform the same operations as their corresponding intrinsic methods perform.Returns
The methods on the
Nameprototype object return what their corresponding intrinsic methods return.Implementation
prototype function toString(this : Name) this.Private::toString();_______________________________________________ Es4-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es4-discuss
