Logtalk user manual

User Manual

Logtalk Features
Logtalk Nomenclature
Message Sending
Event-driven Programming
Multi-threading Programming
Error Handling
Documenting Logtalk Programs
Installing Logtalk
Writing, Running, and Debugging Logtalk Applications
Prolog Integration and Migration Guide

Logtalk Features

Integration of logic and object-oriented programming
Integration of event-driven and object-oriented programming
Support for component-based programming
Support for both prototype and class-based systems
Support for multiple object hierarchies
Separation between interface and implementation
Private, protected, and public inheritance
Private, protected, and public object predicates
Parametric objects
High level multi-threading programming support
Smooth learning curve
Compatibility with most Prologs and the ISO standard
Logtalk scope

Logtalk Nomenclature

C++ nomenclature
Java nomenclature

Message Sending

Operators used in message sending
Sending a message to an object
Delegating a message to an object
Sending a message to self
Calling imported and inherited predicate definitions
Message sending and event generation
Message sending performance


Objects, prototypes, classes, and instances
Defining a new object
Parametric objects
Finding defined objects
Creating a new object in runtime
Abolishing an existing object
Object directives
Object initialization
Dynamic objects
Object documentation
Loading files into an object
Object relationships
Object properties
Built-in objects
The built-in pseudo-object user
The built-in object logtalk


Defining a new protocol
Finding defined protocols
Creating a new protocol in runtime
Abolishing an existing protocol
Protocol directives
Dynamic protocols
Protocol documentation
Loading files into a protocol
Protocol relationships
Protocol properties
Implementing protocols
Built-in protocols
The built-in protocol expanding
The built-in protocol monitoring
The built-in protocol forwarding


Defining a new category
Hot patching
Finding defined categories
Creating a new category in runtime
Abolishing an existing category
Category directives
Dynamic categories
Category documentation
Loading files into a category
Category relationships
Category properties
Importing categories
Calling category predicates
Parametric categories


Reserved predicate names
Declaring predicates
Scope directives
Mode directive
Meta-predicate directive
Discontiguous directive
Dynamic directive
Operator directive
Uses directive
Alias directive
Documenting directive
Multifile directive
Coinductive directive
Defining predicates
Object predicates
Category predicates
Lambda expressions
Definite clause grammar rules
Built-in object predicates (methods)
Execution context methods
Error handling and throwing methods
Database methods
Meta-call methods
All solutions methods
Reflection methods
Definite clause grammar parsing methods and non-terminals
Term and goal expansion methods
Printing messages
Asking questions
Predicate properties
Finding declared predicates
Calling Prolog built-in predicates
Calling Prolog non-standard meta-predicates
Calling Prolog user-defined predicates
Calling Prolog module predicates


Protocol inheritance
Search order for prototype hierarchies
Search order for class hierarchies
Implementation inheritance
Search order for prototype hierarchies
Search order for class hierarchies
Inheritance versus predicate redefinition
Public, protected, and private inheritance
Composition versus multiple inheritance

Event-driven Programming

Event generation
Communicating events to monitors
Performance concerns
Monitor semantics
Activation order of monitors
Event handling
Defining new events
Abolishing defined events
Finding defined events
Defining event handlers

Multi-threading Programming

Enabling multi-threading support
Enabling objects to make multi-threading calls
Multi-threading built-in predicates
Proving goals concurrently using threads
Proving goals asynchronously using threads
One-way asynchronous calls
Asynchronous calls and synchronized predicates
Synchronizing threads through notifications
Multi-threading performance

Error Handling

Compiler warnings and errors
Unknown entities
Singleton variables
Redefinition of Prolog built-in predicates
Redefinition of Logtalk built-in predicates
Redefinition of Logtalk built-in methods
Misspell calls of local predicates
Portability warnings
Missing directives
Trivial fails
Redefinition of predicates declared in uses/2 and use_module/2 directives
Other warnings and errors
Runtime errors
Logtalk built-in predicates
Logtalk built-in methods
Message sending

Documenting Logtalk Programs

Documenting directives
Entity directives
Predicate directives
Processing and viewing documenting files

Installing Logtalk

Installing Logtalk
Hardware and software requirements
Computer and operating system
Prolog compiler
Logtalk installers
Source distribution
Directories and files organization
Adapter files
Settings files
Logtalk compiler and runtime
Logtalk source files

Writing, Running, and Debugging Logtalk Applications

Writing applications
Source files
Loader utility files
Libraries of source files
Portable applications
Conditional compilation
Avoiding common errors
Coding style guidelines
Running a Logtalk session
Starting Logtalk
Compiling and loading your applications
Compiler linter
Compiler flags
Reloading and smart compilation of source files
Using Logtalk for batch processing
Optimizing performance
Debugging Logtalk applications
Compiling source files and entities in debug mode
Logtalk Procedure Box model
Defining spy points
Tracing program execution
Debugging using spy points
Debugging commands
Context-switching calls
Using compilation hooks and term expansion for debugging
Debugging messages

Prolog Integration and Migration Guide

Source files with both Prolog code and Logtalk code
Encapsulating plain Prolog code in objects
Prolog multifile predicates
Converting Prolog modules into objects
Compiling Prolog modules as objects
Supported module directives
Current limitations and workarounds
Dealing with proprietary Prolog directives
Calling Prolog module predicates
Compiling Prolog module multifile predicates