src/pmc/role.pmc - Role - defines a role
This class implements the basic Parrot role PMC,
for defining a role.
void init()
- Initializes the role.
void init_pmc(PMC *name)
- The actual role creation code,
called from
newrole
opcode.
The init
argument should stringify to the name of the role.
The role will be attatched to the current namespace.
void destroy()
- Free the memory associated with the underlying struct.
void mark()
- Mark any referenced strings and PMCs.
void attributes()
- Return a hash where the keys are attribute names and the values are instances of MetaAttribute,
describing the attribute.
void add_attribute()
- Add an attribute to the role.
Requires a name and,
optionally,
a type.
void name()
- Sets the name of the role.
void namespace()
- With a parameter,
sets the namespace for the role.
Expects a fully qualified namespace to be specified as a key.
If you already have linked another namespace with this role,
this link will be broken and the new namespace specified will be linked to this role.
void roles()
- Return the roles array PMC.
void add_method(STRING *name, PMC *sub)
- Adds the given sub PMC as a method with the given name.
docs/pdds/pdd15_objects.pod.