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


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_PMCProxy structure, which has the following fields.


The type number of the PMC that is being described.


The name of the PMC -- a STRING.


The namespace the PMC is associated with, if any.


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


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"


Functions ^

void init()

Initializes a PMCProxy 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.

PMC *inspect_str(STRING *what)

Provides introspection of a specific piece of information about the PMC. The available information is:


String PMC containing the name of the PMC


NameSpace PMC of the the namespace attached to the PMC


Hash keyed on method name, value is an invokable PMC


Array of PMCProxy PMCs representing the direct parents of this 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 pmc_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.