HOME

TheInfoList



OR:

Logtalk is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of "objects", which can contain data and code. The data is in the form of fields (often known as attributes or ''properties''), and the code is in the form of ...
logic programming Logic programming is a programming paradigm which is largely based on formal logic. Any program written in a logic programming language is a set of sentences in logical form, expressing facts and rules about some problem domain. Major logic pro ...
language that extends and leverages the
Prolog Prolog is a logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily ...
language with a feature set suitable for
programming in the large In software engineering, programming in the large and programming in the small refer to two different aspects of writing software, namely, designing a larger system as a composition of smaller parts, and creating those smaller parts by writing li ...
.Paulo Moura (2003). Logtalk: Design of an Object-Oriented Logic Programming Language. PhD thesis. Universidade da Beira Interior It provides support for encapsulation and data hiding,
separation of concerns In computer science, separation of concerns is a design principle for separating a computer program into distinct sections. Each section addresses a separate '' concern'', a set of information that affects the code of a computer program. A concern ...
and enhanced code reuse. Logtalk uses standard Prolog syntax with the addition of a few operators and directives. The Logtalk language implementation is distributed under an
open source license An open-source license is a type of license for computer software and other products that allows the source code, blueprint or design to be used, modified and/or shared under defined terms and conditions. This allows end users and commercial comp ...
and can run using a Prolog implementation (compliant with official and de facto standards) as the back-end compiler.


Features

Logtalk aims to bring together the advantages of object-oriented programming and logic programming. Object-orientation emphasizes developing discrete, reusable units of software, while logic programming emphasizes representing the knowledge of each object in a declarative way. As an object-oriented programming language, Logtalk's major features include support for both classes (with optional metaclasses) and
prototypes A prototype is an early sample, model, or release of a product built to test a concept or process. It is a term used in a variety of contexts, including semantics, design, electronics, and software programming. A prototype is generally used to ...
, parametric objects, protocols (
interfaces Interface or interfacing may refer to: Academic journals * ''Interface'' (journal), by the Electrochemical Society * '' Interface, Journal of Applied Linguistics'', now merged with ''ITL International Journal of Applied Linguistics'' * '' Int ...
), categories (components, aspects,
hot patching Hot or the acronym HOT may refer to: Food and drink *Pungency, in food, a spicy or hot quality *Hot, a wine tasting descriptor Places * Hot district, a district of Chiang Mai province, Thailand **Hot subdistrict, a sub-district of Hot Distric ...
),
multiple inheritance Multiple inheritance is a feature of some object-oriented computer programming languages in which an object or class can inherit features from more than one parent object or parent class. It is distinct from single inheritance, where an object or ...
, public/protected/private inheritance,
event-driven programming In computer programming, event-driven programming is a programming paradigm in which the flow of the program is determined by events such as user actions (mouse clicks, key presses), sensor outputs, or message passing from other programs or thr ...
, high-level multi-threading programming,
reflection Reflection or reflexion may refer to: Science and technology * Reflection (physics), a common wave phenomenon ** Specular reflection, reflection from a smooth surface *** Mirror image, a reflection in a mirror or in water ** Signal reflection, in ...
, and automatic generation of documentation. For Prolog programmers, Logtalk provides wide portability, featuring predicate
namespace In computing, a namespace is a set of signs (''names'') that are used to identify and refer to objects of various kinds. A namespace ensures that all of a given set of objects have unique names so that they can be easily identified. Namespaces ...
s (supporting both static and dynamic objects), public/protected/private object predicates, coinductive predicates, separation between interface and implementation, simple and intuitive meta-predicate semantics, lambda expressions, definite clause grammars, term-expansion mechanism, and conditional compilation. It also provides a module system based on de facto standard core module functionality (internally, modules are compiled as prototypes).


Examples

Logtalk's syntax is based on Prolog: ?- write('Hello world'), nl. Hello world true. Defining an object: :- object(my_first_object). :- initialization((write('Hello world'), nl)). :- public(p1/0). p1 :- write('This is a public predicate'), nl. :- private(p2/0). p2 :- write('This is a private predicate'), nl. :- end_object. Using the object, assuming is saved in a my_first_object.lgt file: ?- logtalk_load(my_first_object). Hello world true. ?- my_first_object::p1. This is a public predicate true. Trying to access the private predicate gives an error: ?- my_first_object::p2. ERROR: error(permission_error(access, private_predicate, p2), my_first_object::p2, user)


Anonymous functions


Prolog back-end compatibility

Supported back-end Prolog compilers include
B-Prolog B-Prolog was a high-performance implementation of the standard Prolog language with several extended features including matching clauses, action rules for event handling, finite-domain constraint solving, arrays and hash tables, declarative loops, ...
, Ciao Prolog
CxProlog
ECLiPSe An eclipse is an astronomical event that occurs when an astronomical object or spacecraft is temporarily obscured, by passing into the shadow of another body or by having another body pass between it and the viewer. This alignment of three c ...
,
GNU Prolog GNU Prolog (also called gprolog) is a compiler developed by Daniel Diaz with an interactive debugging environment for Prolog available for Unix, Windows, Mac OS X and Linux. It also supports some extensions to Prolog including constraint programm ...

JIPrologQuintus PrologScryer Prolog
SICStus Prolog Prolog is a logic programming language associated with artificial intelligence and computational linguistics. Prolog has its roots in first-order logic, a formal logic, and unlike many other programming languages, Prolog is intended primarily a ...
, SWI-Prolog
Tau PrologTrealla Prolog
XSB XSB is the name of a dialect of the Prolog programming language and its implementation developed at Stony Brook University in collaboration with the Katholieke Universiteit Leuven, the New University of Lisbon, Uppsala University and software ve ...
, and
YAP Yap ( yap, Waqaab) traditionally refers to an island group located in the Caroline Islands of the western Pacific Ocean, a part of Yap State. The name "Yap" in recent years has come to also refer to the state within the Federated States of Micr ...
. Logtalk allows use of back-end Prolog compiler libraries from within object and categories.


Developer tools

Logtalk features on-line help, a documenting tool (that can generate PDF and HTML files), an entity diagram generator tool, a built-in debugger (based on an extended version of the traditional Procedure Box model found on most Prolog compilers), a unit test framework with code coverage analysis, and is also compatible with selected back-end Prolog profilers and graphical tracers.


Applications

Logtalk has been used to process STEP data models used to exchange product manufacturing information. It has also been used to implement a reasoning system that allows preference reasoning and
constraint solving Constraint may refer to: * Constraint (computer-aided design), a demarcation of geometrical characteristics between two or more entities or solid modeling bodies * Constraint (mathematics), a condition of an optimization problem that the solution m ...
.


See also

* Mercury (programming language) *
Oz (programming language) Oz is a multiparadigm programming language, developed in the Programming Systems Lab at Université catholique de Louvain, for programming language education. It has a canonical textbook: Concepts, Techniques, and Models of Computer Programmi ...
* Prolog++ * Visual Prolog


References


External links

*{{official website, //logtalk.org
Logtalking blog
*From Plain Prolog to Logtalk Objects: Effective Code Encapsulation and Reuse (Invited Talk). Paulo Moura. Proceedings of the 25th International Conference on Logic Programming (ICLP), July 2009. LNCS 5649. Springer-Verlag Berlin Heidelberg".
Slides
Object-oriented programming languages Logic programming languages Prolog programming language family