# Glossary

abstract class

  A class that cannot be instantiated by sending it a message. Usually used to contain common predicates that are inherited by other classes.

abstract method

  A method implementing an algorithm whose step corresponds to calls to methods defined in the descendants of the object (or category) containing it.

adapter file

  A Prolog source file defining a minimal abstraction layer between the Logtalk compiler/runtime and a specific backend Prolog compiler.

ancestor

  A class or a parent prototype that contributes (via inheritance) to the definition of an object. For class-based hierarchies, the ancestors of an instance are its class(es) and all the superclasses of its class(es). For prototype-based hierarchies, the ancestors of a prototype are its parent(s) and the ancestors of its parent(s).

backend Prolog compiler

  The Prolog compiler that is used to host and run Logtalk and that is called for compiling the intermediate Prolog code generated by the Logtalk compiler when compiling source files.

built-in method

  A predefined method that can be called from within any object or category. I.e. built-in methods are built-in object and category predicates. Built-in methods cannot be redefined.

built-in predicate

  A predefined predicate that can be called from anywhere. Built-in predicates can be redefined within objects and categories.

category

  A set of predicates directives and clauses that can be (virtually) imported by any object. Categories support composing objects using fine-grained units of code reuse and also hot patching of existing objects. A category should be functionally-cohesive, defining a single functionality.

class

  An object that specializes another object, interpreted as its superclass. A class define the common predicates of a set of objects that instantiates it. An object can also be interpreted as a class when it instantiates itself.

closed-world assumption

  The assumption that what cannot be proved true is false. Therefore, sending a message corresponding to a declared but not defined predicate, or calling a declared predicate with no clauses, fails. But messages or calls to undeclared predicates generate an error.

closure

  A callable term (i.e. an atom or a compound term) passed to a meta-predicate call where it is extended with additional arguments to form a goal called by the meta-predicate.

coinductive predicate

  A predicate whose calls are proved using greatest fixed point semantics. Coinductive predicates allows reasoning about infinite rational entities such as cyclic terms and ω-automata.

complementing category

  A category used for hot patching an existing object (or a set of objects).

component

  A unique atom or compound term template identifying a library, tool, application, or application sub-system. Component names are notably used by the message printing and question asking mechanisms. Compound terms are used instead of atoms when parameterization is required.

directive

  A source file term that affects the interpretation of source code. Directives use the `(:-)/1` prefix operator as functor.

discontiguous predicate

  A predicate whose clauses are not contiguous in a source file. I.e. a predicate whose clauses are mixed with clauses for other predicates.

doclet file

  A source file whose main purpose is to generate documentation for e.g. a library or an application.

doclet object

  An object specifying the steps necessary to (re)generate the API documentation for a project. See the doclet and lgtdoc tools for details.

dynamic binding

  Runtime lookup of a predicate declaration and predicate definition to verify the validity of a message (or a super call) and find the predicate definition that will be used to answer the message (or the super call). Also known as late binding. See also static binding.

dynamic entity

  See entity.

dynamic predicate

  A predicate whose clauses can be dynamically added or retracted at runtime.

early binding

  See static binding.

encapsulation

  The hiding of an object implementation. This promotes software reuse by isolating the object clients from its implementation details. Encapsulation is enforced in Logtalk by using predicate scope directives.

entity

  Generic name for Logtalk compilation units: objects, categories, and protocols. Entities share a single namespace (i.e. entity identifiers must be unique) and can be static (the default) or dynamic. Static entities are defined in source files. Dynamic entities can also be defined in source files but are usually created and abolished at runtime using the language built-in predicates.

entity directive

  A directive that affects how Logtalk entities are used or compiled.

event

  The sending of a message to an object. An event can be expressed as an ordered tuple: `(Event, Object, Message, Sender)`. Logtalk distinguish between the sending of a message — `before` event — and the return of control to the sender — `after` event.

expansion workflow

  A sequence of term-expansion or goal-expansion steps where each step is usually defined using a hook object or a combination of hook objects.

grammar rule

  An alternative notation for predicates used to parse or generate sentences on some language. This notation hides the arguments used to pass the sequences of tokens being processed, thus simplifying the representation of grammars. Grammar rules are represented using as functor the infix operator `(-->)/2` instead of the `(:-)/2` operator used with predicate clauses.

grammar rule non-terminal

  A syntactic category of words or phrases. A non-terminal is identified by its non-terminal indicator, i.e. by its name and number of arguments using the notation `Name//Arity`.

grammar rule terminal

  A word or basic symbol of a language.

hook object

  An object, implementing the expanding built-in protocol, defining term- and goal-expansion predicates, used in the compilation of Logtalk or Prolog source files. A hook object can be specified using the hook flag. It can also be specified using a set_logtalk_flag/2 directive in the source files to be expanded.

hook predicate

  A predicate, usually declared multifile, that allows the user to customize another predicate or provide alternative definitions for a default predicate definition.

hot patching

  The act of fixing entity directives and predicates or adding new entity directives and predicates to loaded entities in a running application without requiring access to the entities source code or restarting the application. Achieved using complementing categories.

identity

  Property of an entity that distinguishes it from every other entity. The identifier of an entity is its functor (i.e. its name and arity), which must be unique. Object and category identifiers can be atoms or compound terms. Protocol identities must be atoms. All Logtalk entities (objects, protocols, and categories) share the same namespace.

inheritance

  An entity inherits predicates directives and clauses from related entities. In the particular case of objects, when an object extends other object, we have prototype-based inheritance. When an object specializes or instantiates another object, we have class-based inheritance. See also public inheritance, protected inheritance, and private inheritance.

instance

  An object that instantiates one another object, interpreted as its class. An object may instantiate multiple objects (also known as multiple instantiation).

instantiation

  The process of creating a new class instance. In Logtalk, this does not necessarily imply dynamic creation of an object at runtime; an instance may also be defined as a static object in a source file.

interface

  See protocol.

lambda expression

  A compound term that can be used in place of a goal or closure meta-argument and that abstracts a predicate definition by listing its variables and a callable term that implements the definition. Lambda expressions help avoiding the need of naming and defining auxiliary predicates.

lambda free variable

  A variable that is global to a lambda expression. All used global variables must be explicitly listed in a lambda expression for well-defined semantics.

lambda parameter

  A term (usually a variable or a non-ground compound term) that is local to a lambda expression. All lambda parameters must be explicitly enumerated in a lambda expression for well-defined semantics.

late binding

  See dynamic binding.

library

  A directory containing source files. See also library alias and library notation.

library alias

  An atom that can be used as an alias for a library full path. Library aliases and their corresponding paths can be defined using the logtalk_library_path/2 predicate. See also library notation.

library notation

  A compound term where the name is a library alias and the single argument is a source file relative path. Use of library notation simplifies compiling and loading source files and can make an application easily relocatable by defining an alias for the root directory of the application files.

loader file

  A source file whose main purpose is to load a set of source files (possibly with specific compiler flags) and any library dependencies.

local predicate

  A predicate that is defined in an object (or in a category) but that is not listed in a scope directive. These predicates behave like private predicates but are invisible to the reflection built-in methods. Local predicates are usually auxiliary predicates and only relevant to the entity where they are defined.

message

  A query sent to an object. In logical terms, a message can be seen as a request for proof construction using an object database and the databases of related entities.

message lookup

  Sending a message to an object requires a lookup for the predicate declaration, to check if the message is within the scope of the sender, and a lookup for the predicate definition that is going to be called to answer the message. Message lookup can occur at compile time or at runtime.

message to self

  A message sent to the object that received the original message under processing. Messages to self require dynamic binding as the value of self is only know at runtime.

meta-argument

  A predicate argument that is called as a goal, used as a closure to construct a goal that will be called, or that is handled in a way that requires awareness of the predicate calling context.

meta-interpreter

  A program capable of running other programs written in the same language.

meta-predicate

  A predicate with one or more meta-arguments. For example, call/1-N and findall/3 are built-in meta-predicates.

meta-variable

  A variable in a meta-argument position that is expected to be unified with a goal or a closure at runtime.

metaclass

  The class of a class, when interpreted as an instance. Metaclass instances are themselves classes. Metaclasses are optional, except for the root class, and can be shared by several classes.

method

  The predicate definition used to answer a message sent to an object. Logtalk supports both static binding and dynamic binding to find which method to run to answer a message.

module

  A Prolog entity characterized by an identity and a set of predicates directives and clauses. Prolog modules are usually static although some Prolog systems allow the creation of dynamic modules at runtime. Prolog modules can be seen as prototypes.

monitor

  Any object, implementing the monitoring built-in protocol, that is notified by the runtime when a spied event occurs. The spied events can be set by the monitor itself or by any other object.

multifile predicate

  A predicate whose clauses can be defined in multiple entities and source files. The object or category holding the directive without an entity prefix qualifying the predicate holds the multifile predicate primary declaration, which consists of both a scope directive and a multifile/1 directive for the predicate.

naked meta-variable

  A meta-variable used as the body of a predicate clause or grammar rule or used in a cut-transparent argument of a control construct. The “naked” designation highlights that the meta-variable is not wrapped by `call/1` or `phrase//1` goals.

object

  An entity characterized by an identity and a set of predicates directives and clauses. Logtalk objects can be either static or dynamic. Logtalk objects can play the role of classes, instances, or prototypes. The role or roles an object plays are a function of its relations with other objects.

object database

  The set of predicates locally defined inside an object.

parameter

  An argument of a parametric object or a parametric category identifier. Parameters are logical variables implicitly shared by all the entity predicate clauses.

parameter variable

  A variable used as parameter in a parametric object or a parametric category using the syntax `_ParameterName_`. Parameter variables are logical variables shared by all entity terms. Occurrences of parameter variables in entity directives and clauses are implicitly unified with the corresponding entity parameters.

parametric category

  See parametric entity.

parametric entity

  An object or category whose identifier is a compound term possibly containing free variables that can be used to parameterize the entity predicates. Parameters are logical variables implicitly shared by all the entity clauses. Note that the identifier of a parametric entity is its functor, irrespective of the possible values of its arguments (e.g. `foo(bar)` and `foo(baz)` are different parameterizations of the same parametric entity, `foo/1`).

parametric object

  See parametric entity.

parametric object proxy

  A compound term (usually represented as a plain Prolog fact) with the same name and number of arguments as the identifier of a parametric object.

parent

  A prototype that is extended by another prototype.

polymorphism

  Different objects (and categories) can provide different implementations of the same predicate. The predicate declaration can be inherited from a common ancestor, also known as subtype polymorphism. Logtalk implements single dispatch on the receiver of a message, which can be described as single-argument polymorphism. As message lookup only uses the predicate functor, multiple predicate implementations for different types of arguments are possible, also known as ad hoc polymorphism. Parametric objects and categories enable implementation of parametric polymorphism by using one of more parameters to pass object identifiers that can be used to parameterize generic predicate definitions.

predicate

  Predicates describe what is true about the application domain. A predicate is identified by its predicate indicator, i.e. by its name and number of arguments using the notation `Name/Arity`. When predicates defined in objects or categories they are also referred to as methods.

predicate alias

  An alternative functor (`Name/Arity`) for a predicate. Predicate aliases can be defined for any inherited predicate using the alias/2 directive and for predicates listed in uses/2 and use_module/2 directives. Predicate aliases can be used to solve inheritance conflicts and to improve code clarity by using alternative names that are more meaningful in the calling context.

predicate calling context

  The object or category from within a predicate is called (either directly or using a control construct such as a message sending control construct).

predicate declaration

  A predicate declaration is composed by a set of predicates directives, which must include ar least a scope directive.

predicate definition

  The set of clauses for a predicate, contained in an object or category. Predicate definitions can be overriden or specialized in descendant entities.

predicate definition context

  The object or category that contains the definition (i.e. clauses) for a predicate.

predicate directive

  A directive that specifies a predicate property that affects how predicates are called or compiled.

predicate execution context

  The implicit arguments (including sender, self, and this) required for the correct execution of a predicate call.

predicate scope container

  The object that inherits a predicate declaration from an imported category or an implemented protocol.

predicate scope directive

  A directive that declares a predicate by specifying its visibility as public, protected, or private.

predicate shorthand

  A predicate alias that defines a call template, possibly using a different name, with a reduced number of arguments by hard-coding the value of the omitted arguments in the original call template. Predicate shorthands can be defined using uses/2 and use_module/2 directives. They can be used to simplify predicate calls and to ensure consistent call patterns when some of the arguments always use the same fixed values in the calling context.

primary predicate declaration

  See multifile predicate.

private inheritance

  All public and protected predicates are inherited as private predicates. See also public inheritance and protected inheritance.

private predicate

  A predicate that can only be called from the object that contains its scope directive.

profiler

  A program that collects data about other program performance.

protected inheritance

  All public predicates are inherited as protected. No scope change for protected or private predicates. See also public inheritance and private inheritance.

protected predicate

  A predicate that can only be called from the object containing its scope directive or from an object that inherits the predicate.

protocol

  An entity that contains predicate declarations. A predicate is declared using a scope directive. It may be further specified by additional predicate directives. Protocols support the separation between interface and implementation, can be implemented by both objects and categories, and can be extended by other protocols. A protocol should be functionally-cohesive, specifying a single functionality. Also known as interface.

prototype

  A self-describing object that may extend or be extended by other objects. An object with no instantiation or specialization relations with other objects is always interpreted as a prototype.

public inheritance

  All inherited predicates maintain their declared scope. See also protected inheritance and private inheritance.

public predicate

  A predicate that can be called from any object.

scratch directory

  The directory used to save the intermediate Prolog files generated by the compiler when compiling source files.

self

  The object that received the message under processing.

sender

  An object that sends a message to other object. When a message is sent from within a category, the sender is the object importing the category.

settings file

  A source file, compiled and loaded automatically by default at Logtalk startup, mainly defining default values for compiler flags that override the defaults found on the backend Prolog compiler adapter files.

singleton method

  A method defined in an instance itself. Singleton methods are supported in Logtalk and can also be found in other object-oriented programming languages.

source file

  A text file defining Logtalk and/or Prolog code. Multiple Logtalk entities may be defined in a single source file. Plain Prolog code may be intermixed with Logtalk entity definitions. Depending on the used backend Prolog compiler, the text encoding may be specified using an encoding/1 directive as the first term in the first line in the file.

source file directive

  A directive that affects how a source file is compiled.

specialization

  A class is specialized by defining a new class that inherit its predicates and possibly add new ones.

static binding

  Compile time lookup of a predicate declaration and predicate definition when compiling a message sending call (or a super call). Dynamic binding is used whenever static binding is not possible (e.g. due to the predicate being dynamic or due to lack of enough information at compilation time). Also known as early binding. See also dynamic binding.

static entity

  See entity.

steadfastness

  A predicate definition is steadfast when it still generates only correct answers when called with unexpected arguments (notably, bound output arguments). Typically, a predicate may not be steadfast when output argument unifications can occur before a cut in a predicate clause body.

subclass

  A class that is a specialization, direct or indirectly, of another class. A class may have multiple subclasses.

super call

  Call of an inherited (or imported) predicate definition. Mainly used when redefining an inherited (or imported) predicate to call the overridden definition while making additional calls. Super calls preserve self and may require dynamic binding if the predicate is dynamic.

superclass

  A class from which another class is a specialization (directly or indirectly via another class). A class may have multiple superclasses.

synchronized predicate

  A synchronized predicate is protected by a mutex ensuring that, in a multi-threaded application, it can only be called by a single thread at a time.

template method

  See abstract method.

tester file

  A source file whose main purpose is to load and a run a set of unit tests.

this

  The object that contains the predicate clause under execution. When the predicate clause is contained in a category, this is a reference to the object importing the category for which the predicate clause is being executed.

threaded engine

  A computing thread running a goal whose solutions can be lazily and concurrently computed and retrieved. A threaded engine also supports a term queue that allows passing arbitrary terms to the engine. This queue can be used to pass e.g. data and new goals to the engine.

top-level interpreter shorthand

  Aliases for frequently used built-in predicates such as logtalk_load/1 and logtalk_make/1. These shorthands are not part of the Logtalk language and must only be used at the top-level interpreter.

visible predicate

  A predicate that is within scope, a locally defined predicate, a built-in method, a Logtalk built-in predicate, or a Prolog built-in predicate.