NAME ^

src/pmc/pmcproxy.pmc - proxy class object for a PMC enabling introspection

DESCRIPTION ^

This class is used to describe a PMC. It can sit in an inheritance hierarchy of a PDD15 class as well as allowing introspection of the PMC.

PMCProxy is not derived from any other PMC.

Structure ^

This class stores its state in the Parrot_Class structure, using the following fields.

id

The type number of the PMC that is being described.

name

The name of the PMC -- a STRING.

namespace

The namespace the PMC is associated with, if any.

parents

An array of immediate parent classes. An empty ResizablePMCArray PMC is allocated during initialization.

all_parents

A cached array of ourself and all parent classes, in MRO order. A ResizablePMCArray PMC is allocated during initialization, and is populated with the current class.

NOTE: No doubt we will need other things later; this is a start.

*/

#include "parrot/parrot.h" #include "parrot/oo_private.h"

/*

Functions ^

void init()

Initializes a PMCProxy PMC.

PMC *instantiate(PMC *init)

Creates an instance of the PMC.

void destroy()

Free the memory associated with the object's underlying struct.

void mark()

Mark any referenced strings and PMCs in the structure as live.

INTVAL isa_pmc(PMC *classname)

Returns whether the class is or inherits from *classname.

INTVAL isa(STRING *classname)

Returns whether the class is or inherits from *classname.

INTVAL does(STRING *role_name)

Returns whether the class does the role with the given *rolename.

INTVAL type()

Returns the integer type of the class.

PMC *inspect()

Returns a Hash describing the PMC, with key/value pairs as described in inspect_str.

STRING *name()

Gets the name of the PMC.

void get_namespace()

Gets the namespace that this class is attached to.

void new(PMC *args)

Creates an instance of the PMC.

void methods()

Return a hash where the keys are method names and the values are methods.

void parents()

Return the parents array PMC.

void inspect(STRING *what :optional)

Gets all introspection data for the PMC or, if the optional string parameter is supplied, a particular item of introspection data.

STRING *get_string()

Return the name of the low-level class (without the HLL namespace).

SEE ALSO ^

docs/pdds/pdd17_pmc.pod.


parrot