plo is an object oriented extension for prolog.
15 Nov 2004
oattr_get(Obj, Attr, Value)
Ground: Obj
Ground: Attr
Unrestricted: Value
retrieves value (or values via backtracking) for object attribute.
oattr_reset(Obj, Attr, Value)
Ground: Obj
Ground: Attr
Ground: Value
unsets all values of object attribute and sets it to new value Value.
oattr_set(Obj, Attr, Value)
Ground: Obj
Ground: Attr
Ground: Value
sets a new value for object attribute
oattr_set(Obj, Attr, Value)
Ground: Obj
Ground: Attr
Ground: Value
sets a new value for object attribute at the head (think assert/1 and asserta/1).
oattr_unset(Obj, Attr)
Ground: Obj
Ground: Attr
calls oattr_unset(Obj, Attr, _).
oattr_unset(Obj, Attr, Value)
Ground: Obj
Ground: Attr
Unrestricted: Value
unsets object attribute value matching Value
oattr_unset_all(Obj, Attr)
Ground: Obj
Ground: Attr
calls oattr_unset_all(Obj, Attr, _).
oattr_unset_all(Obj, Attr, Value)
Ground: Obj
Ground: Attr
Unrestricted: Value
unsets all values of object attribute matching Value
ocheck_object(Obj, Class)
Ground: Obj
Unrestricted: Class
checks that Obj is a valid object of a class that unifies with Class.
oclass(Obj, Class, MetaClass)
Unrestricted: Obj
Unrestricted: Class
Unrestricted: MetaClass
relation pairing objects and classes. MetaClass is included for performance.
ocompile_method(Class, Name/Arity)
Ground: Class
Ground: Name
Ground: Arity
compiles method with name Name and arity Arity on class Class
ocompile_methods(Class, List)
Ground: Class
Ground: List = [Name1/Arity1, Name2/Arity2, ...]
as ocompile_method/2 but accepts a list of method name/arity pairs.
odelete(Obj)
Ground: Obj
calls the method Class::delete_instance(Obj), being Class the class of Obj.
Use this predicate to delete objects.
oinstance(Class, Obj)
Ground: Class
Unrestricted: Obj
iterates over all the instances of class Class
oisa(Obj, Class)
Ground: Obj
Unrestricted: Class
iterates over all the classes Obj belongs to
omake(Class, Obj)
Ground: Class
Ground: Obj
Ground: Class
Unground: Obj
calls Class::make(Obj).
Usually, you will not use this predicate but onew/2 or onew/3, that call the init/1 method on the new constructed object.
omethod(Class, Fact)
Ground: Class
Ground: Fact
defines a new method without body for class Class. Equivalent to omethod(Class, Fact, true).
omethod(Class, Head, Body)
Ground: Class,
Ground: Head,
Ground: Body
defines a new method Method with body Body on class Class.
omethoda(Class, Fact)
Ground: Class
Ground: Fact
defines a new method without body for class Class and insert it before any other definition for the same method (think on assert/1 asserta/1). Equivalent to omethoda(Class, Fact, true).
omethoda(Class, Head, Body)
Ground: Class,
Ground: Head,
Ground: Body
similar to omethod/3 but inserts the new method definition at the head.
onew(Class, Obj)
Ground: Class
Ground: Obj
Ground: Class
Unground: Obj
calls onew(Class, Obj, [])
onew(Class, Obj, Args)
Ground: Class
Ground: Obj
Unrestricted: Args
Ground: Class
Unground: Obj
Unrestricted: Args
calls Class::make(Obj) and then Obj::init(Args) when init/1 method is defined in Class.
Use this predicate (or onew/2) to create new objects.
onew_class(Name)
Ground: Name
creates a new class of metaclass 'rootmc' and no parents
onew_class(Name, Parents)
Ground: Name
Ground: Parents
creates a new class with parents Parents. Class metaclass is the same as that of the first parent class.
onew_class(Name, Parents, Metaclass)
Ground: Name
Ground: Parents
Ground: Metaclass
similar to onew_class/2 but allows to explicitly set the Metaclass for the new class. No check is performed to ensure that all parent classes are compatible with the selected metaclass.
oretract_method(Class, Method)
Ground: Class,
Ground: Method
retracts first method matching Method from class Class
osend(Obj, Method)
Ground: Obj
Ground: Method
calls method Method on Obj.
osend(Class, Obj, Method)
Ground: Class
Ground: Obj
Ground: Method
calls method Method from class Class on Obj.
Use this method to call methods defined on parent classes (it is not checked that Obj belongs to class Class).
This contruction can also be used to simulate C++ static methods, i.e, :- osend(klass, [], foo(Bar)).
![]() |