TITLE

Object - JS Object class

DESCRIPTION

This file sets up the base classes and methods for JS's object system. Differences (and conflicts) between Parrot's object model and the JS model means we have to do a little name and method trickery here and there, and this file takes care of much of that.

Methods

clone()
Returns a copy of the object.NOTE: Don't copy what this method does; it's a tad inside-out. We should be overriding the clone vtable method to call .clone() really. But if we do that, we can't current get at the Object PMC's clone method, so for now we do it like this.
defined()
Return true if the object is defined.
hash
Return invocant in hash context.
item
Return invocant in item context. Default is to return self.
list
Return invocant in list context. Default is to return a List containing self.
print()
Print the object.
say()
Print the object, followed by a newline.
true()
Boolean value of object -- defaults to .defined (S02).

Coercion methods

Array()
Hash()
Iterator()
Scalar()
Default Scalar() gives reference type semantics, returning an object reference (unless the invocant already is one).
Str()
Return a string representation of the invocant. Default is the object's type and address.

Special methods

new()
Create a new object having the same class as the invocant.
'PARROT'
Report the object's true nature.
REJECTS(topic)
Define REJECTS methods for objects (this would normally be part of the Pattern role, but we put it here for now until we get roles).
WHENCE()
Return the invocant's auto-vivification closure.
WHERE
Gets the memory address of the object.
WHICH
Gets the object's identity value

Private methods

!cloneattr(attrlist)
Create a clone of self, also cloning the attributes given by attrlist.
!.?
Helper method for implementing the .? operator. Calls at most one matching method, and returns undef if there are none.
!.*
Helper method for implementing the .* operator. Calls one or more matching methods.
!.+
Helper method for implementing the .+ operator. Calls one or more matching methods, dies if there are none.
!MANY_DISPATCH_HELPER
This is a helper for implementing .+, .? and .*. In the future, it may well be the basis of WALK also. It returns all methods we could possible call.
!.^
Helper for doing calls on the metaclass.

Vtable functions