Node:The Proto-Object, Next:, Previous:Inlined Methods, Up:Obj Built-In



The Proto-Object "object"

The proto-object object provides basic methods that are available to all other objects by delegation:


super(?Object)
Object is a parent (a super-object) of Self. Note that any other definition of super(Object) are translated to the universal method super/2.
sub(?Object)
Object is a child (a sub-object) of Self.
self(?Self)
Unifies Self with "self". NOTE: this method is inlined when possible.
object(?Object)

One of the defined objects in the system is Object.

dynamic

Self is a dynamic object.

static

Self is a static object.

dynamic ?Name/?Arity

Name/Arity is a dynamic method of Self.

static ?Name/?Arity

Name/Arity is a static method of Self.

new(?Object)

Creates a new dynamic Object. Self will be the prototype of Object. Object can be a compound term, an atom, or a variable. In the last case the method generates a unique name for Object.

+SomeObject :: new(?NewObject,+Supers)

NewObject is created with Supers specifying the super objects (prototypes). Supers is a list containing super specifications. A super specification is either an object identifier or a pair Object-NotInheritList where NotInheritList specifies methods not to inherit from Object. NewObject could be an atom, variable, or compound term whose arguments are distinct variables.

instance(?Instance)

Creates a new instance Instance. Self will be the class of Instance. Instance can be a compound term, an atom, or a variable. In the last case the method generates a unique name for Instance.

has_instance(?Instance)

Self has the instance Instance.

has_attribute(?AttributeSpec)

Self has the attribute AttributeSpec, locally defined or inherited. AttributeSpec is on the format Name/Arity.

get(+Attribute)
Gets the attribute value(s) of the attribute specified by the principal functor of Attribute. The value(s) are unified with the argument(s) of Attribute. NOTE: this method is inlined when possible.
set(+Attribute)
Sets the attribute value(s) of the attribute specified by the principal functor of Attribute. The value(s) are taken from the argument(s) of Attribute. NOTE: this method is inlined when possible.
assert(+Fact)
assert(+Fact, -Ref)
asserta(+Fact)
asserta(+Fact, -Ref)
assertz(+Fact)
assertz(+Fact, -Ref)

Asserts a new Fact in Self. If Self is static, the name and arity of Fact must be declared as a dynamic method. asserta places Fact before any old facts. The other forms place it after any old facts. A pointer to the asserted fact is returned in the optional argument Ref, and can be used by the Prolog built-in predicates erase/1 and instance/2.

retract(+Fact)

Retracts a Fact from Self. If Self is static, the name and arity of Fact must be declared as a dynamic method.

update(+Fact)

Replaces the first fact with the same name and arity as Fact in Self by Fact. If Self is static, the name and arity of Fact must be declared as a dynamic method.

retractall(?Head)

Removes facts from Self that unify with Head. If Self is static, the name and arity of Fact must be declared as a dynamic method.

abolish

Abolishes Self if dynamic.

augment(?ObjectBody)
augmenta(?ObjectBody)
augmentz(?ObjectBody)

ObjectBody, having the form { sentence-1 & ... & sentence-n }, is added to Self. augmenta places the new clauses before any old clauses. The other forms place it after any old clauses.