Last call for comments.

--lars
Title: 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 Name is a final, nullable, non-dynamic, direct subclass of Object that reflects a property name as a pair of Namespace and string values.

COMPATIBILITY NOTE   The Namespace class is new in the 4th Edition of this Standard.

Synopsis

The class Name provides 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 Name prototype object provides the following direct properties:

    toString: function (this: Name) …

Operators

The operators == and === compare as equal two Name objects that are separately created from the same (qualifier,identifier) pair; similarly, the operators != and !== compare as not equal two Name objects that are separately created from (qualifier,identifier) pairs.

Methods on the Name class object

new Name ( id )

Returns

When the Name constructor is called with one argument id it returns a Name object whose qualifier is null and whose identifier is id converted to string.

Implementation

public function Name( id ) …

new Name( ns, id )

Returns

When the Name constructor is called with two arguments ns and id it returns a Name object whose qualifier is ns and whose identifier is id converted to string.

ns may be null.

Implementation

public function Name( ns: Namespace?, id ) …

Name ( ...args )

Description

The Name class object called as a function creates a Name object by invoking the Name constructor on its argument(s).

Returns

The Name class object called as a function returns a Name object.

Implementation

static meta function invoke( ...args ): Name!
    new Name(...args);

Methods on Name instances

intrinsic::toString ( )

Description

The intrinsic toString method converts this Name object to a string.

Returns

The intrinsic toString method 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 Name instances

qualifier

The qualifier property holds the namespace value for this Name object. If qualifier is null then the implied namespace is the compatibility namespace noNS.

identifier

The identifier property holds the identifier value for this Name object. It is never null.

Methods on the Name prototype object

Description

The methods on the Name prototype object perform the same operations as their corresponding intrinsic methods perform.

Returns

The methods on the Name prototype 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

Reply via email to