NAME ^

src/pmc/object.pmc - An instance of a class

DESCRIPTION ^

Implements an instance of a class.

Functions ^

void init()

Raises an exception; you can only instantiate objects from a class.

void init_pmc(PMC *class)

Raises an exception; you can only instantiate objects from a class.

void destroy()

Free the object's underlying struct.

void mark()

Mark any referenced strings and PMCs.

PMC *get_attr_str(STRING *idx)

Gets the value of an attribute for this object. Will find the first attribute of the given name walking up the inheritance tree.

void set_attr_str(STRING *name, PMC *value)

Sets the value of an attribute for this object. Will set the first attribute of the given name walking up the inheritance tree.

PMC *find_method(STRING *method_name)

Walks the MRO of the class and finds the method with the given name.

PMC *get_class()

Get the class PMC representing the class that this object is an instance of.

INTVAL can(STRING *method_name)

Returns 0 if the class does not have a method with the given name and a non-zero value if it does.

SEE ALSO ^

docs/pdds/pdd15_objects.pod.


parrot