object.ops
Parrot's library of object ops
- callmethod()
- callmethod(in STR)
- Call a method on an object.
If a method name is provided,
we find the PMC for the named method and put it into the sub/method slot.
If no name is provided,
then we assume that the method PMC and method name are already in their proper places.
We assume that all other registers are correctly set up,
as per the Parrot calling conventions.
Throws a Method_Not_Found_Exception for a non-existent method.
- callmethodcc()
- callmethodcc(in STR)
- Make a method call,
automatically generating a return continuation.
If a method name is passed in we look up the method PMC for the object and put it in the method slot.
If a method name isn't provided then we assume that things are already properly set up.
Note that the return continuation is placed in P1.
Throws a Method_Not_Found_Exception for a non-existent method.
- tailcallmethod (unimplemented)
- tailcallmethod(in STR)
- Make a tailcall to method $1.
If no method name is given,
we assume everything is already set up properly.
- fetchmethod(out PMC,
in PMC,
in STR)
- Find the method $3 for object $2 and put it in $1.
Throws a Method_Not_Found_Exception for a non-existent method.
The returned PMC may be outdated,
when the call is actually performed and changes to the underlying classes where made.
- can(out INT,
in PMC,
in STR)
- Sets $1 to true or false,
depending on whether $2 ->can the method in $3.
- does(out INT,
in PMC,
in STR)
- Sets $1 to true or false,
depending on whether $2 ->does the interface in $3.
- isa(out INT,
in PMC,
in STR)
- Sets $1 to true or false,
depending on whether $2 isa $3.
- newclass(out PMC,
in STR)
- Creates a new Parrot-style class,
named $2,
and puts the new PMC for it into $1.
(This is a real out--the contents of $1 are ignored and the pointer for the new PMC is put in there).
- subclass(out PMC,
in PMC)
- subclass(out PMC,
in PMC,
in STR)
- subclass(out PMC,
in STR)
- subclass(out PMC,
in STR,
in STR)
- Create a new class,
put in $1,
that is a subclass of $2.
$3,
if available,
is the name of the new class--if not,
the subclass is an anonymous subclass.
- $1 is replaced--a new PMC for the subclass is generated and put in it.
- findclass(out INT,
in STR)
- Returns 1 if the class exists,
0 if it does not.
- getclass(out PMC,
in STR)
- Find the PMC for a class,
by name.
Note that this is a one-level hash,
so for classes that have some structure you need to impose that structure externally.
- Parrot's conventions are that level separators are noted with the NULL character,
so Perl's Foo::Bar would be Foo\0Bar.
- singleton(in PMC) (unimplemented)
- Take the object in $1 and put it into its own singleton class,
which is an anonymous subclass of the object's current class.
- class(out PMC,
in PMC)
- Get the class PMC for the object in $2 and put it in $1.
- classname(out STR,
in PMC)
- Get the class name for the class in $2 and put it in $1.
- addparent(in PMC,
in PMC)
- Add class $2 to the list of parent classes for $1.
- removeparent(in PMC,
in PMC)
- Remove class $2 from class $1's list of parents.
- addattribute(in PMC,
in STR)
- Add the attribute named $2 to the class $1.
- removeattribute(in PMC,
in STR) (unimplemented)
- removeattribute(in PMC,
in INT) (unimplemented)
- Remove attribute $2 from class $1,
specified either by name or offset.
- getattribute(out PMC,
in PMC,
in INT)
- getattribute(out PMC,
in PMC,
in STR)
- Get attribute number $3 from object $2 and put the result in $1.
String attribute names have to be fully qualified.
- setattribute(in PMC,
in INT,
in PMC)
- setattribute(in PMC,
in STR,
in PMC)
- Set attribute $2 of object $1 to $3
- classoffset(out INT,
in PMC,
in STR)
- Returns the offset of the first attribute for class $3 in object $2.
Throws an exception if $3 isn't in $2's hierarchy.
- adddoes(in PMC,
in STR) (unimplemented)
- Add $2 to the list of interfaces that this class claims to implement.
- removedoes(in PMC,
in STR) (unimplemented)
- Remove $2 from the list of interfaces that this class claims to implement.
- makemmd(in PMC,
in INT) (unimplemented)
- Makes vtable entry $2 use Parrot's multimethod dispatch system
- mmdfunc(in INT,
in PMC,
in PMC,
in PMC) (unimplemented)
- Make $4 the function called when MMD function $1 is called for types $2 and $3.
- mmddispatch(out PMC,
in INT,
in PMC,
in PMC) (unimplemented)
- Do a multimethod dispatch for binary MMD function $2 on PMCs $3 and $4,
and put the result in $1.
Copyright (C) 2001-2004 The Perl Foundation.
All rights reserved.
This program is free software.
It is subject to the same license as the Parrot interpreter itself.