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.

Functions ^

onload()

Perform initializations and create the base classes.

infix:=(source) (assignment method)

Assigns source to target. We use the 'item' method to allow Lists and Mappings to be converted into Array(ref) and Hash(ref).

Object methods ^

hash()

Return the scalar as a Hash.

item()

Return the scalar component of the invocant. For most objects, this is simply the invocant itself.

list()

Return the list component of the invocant. For most (Scalar) objects, we create a List containing the invocant.

new()

Create a new object having the same class as the invocant.

WHENCE()

Return the invocant's auto-vivification closure.

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).

true()

Defines the .true method on all objects via prefix:?.

get_bool (vtable)

Returns true if the object is defined, false otherwise.

print()

say()

Print the object

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.

Methods on P6protoobject ^

WHENCE()

Returns the protoobject's autovivification closure.

get_pmc_keyed(key) (vtable method)

Returns a proto-object with an autovivification closure attached to it.


parrot