TITLE ^

Object - Perl 6 Object class

DESCRIPTION ^

This file sets up the base classes and methods for Perl 6's object system. Differences (and conflicts) between Parrot's object model and the Perl 6 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 ^

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 ^


parrot