Logtalk
   HOME

TheInfoList



OR:

Logtalk is an
object-oriented Object-oriented programming (OOP) is a programming paradigm based on the concept of '' objects''. Objects can contain data (called fields, attributes or properties) and have actions they can perform (called procedures or methods and impleme ...
logic programming Logic programming is a programming, database and knowledge representation paradigm based on formal logic. A logic program is a set of sentences in logical form, representing knowledge about some problem domain. Computation is performed by applyin ...
language that extends and leverages the
Prolog Prolog is a logic programming language that has its origins in artificial intelligence, automated theorem proving, and computational linguistics. Prolog has its roots in first-order logic, a formal logic. Unlike many other programming language ...
language with a feature set suitable for programming in the large.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 (sometimes abbreviated as SoC) 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 o ...
and enhanced
code reuse Code reuse is the practice of using existing source code to develop software instead of writing new code. ''Software reuse'' is a broader term that implies using any existing software asset to develop software instead of developing it again. An as ...
. 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 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 Protocol may refer to: Sociology and politics * Protocol (politics), a formal agreement between nation states * Protocol (diplomacy), the etiquette of diplomacy and affairs of state * Etiquette, a code of personal behavior Science and technology ...
(
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'' * '' Inter ...
), categories (components, aspects, hot patching),
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 ...
, public/protected/private inheritance,
event-driven programming In computer programming, event-driven programming is a programming paradigm in which the Control flow, flow of the program is determined by external Event (computing), events. User interface, UI events from computer mouse, mice, computer keyboard, ...
, high-level multi-threading programming, reflection, 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, Ciao Prolog, CxProlog,
ECLiPSe An eclipse is an astronomical event which 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 ...
, GNU Prolog, JIProlog, Quintus Prolog, Scryer Prolog, SICStus Prolog, SWI-Prolog, Tau Prolog, Trealla Prolog, XSB, and YAP. 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.


See also

*
Mercury (programming language) Mercury is a functional logic programming language made for real-world uses. The first version was developed at the University of Melbourne, Computer Science department, by Fergus Henderson, Thomas Conway, and Zoltan Somogyi, under Somogyi's ...
*
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 Programming ...
* Prolog++ *
Visual Prolog Visual Prolog, previously known as PDC Prolog and Turbo Prolog, is a strongly typed object-oriented extension of Prolog. It was marketed by Borland as Turbo Prolog (version 1.0 in 1986 and version 2.0 in 1988). It is now developed and marketed by ...
* Comparison of Prolog implementations * Prolog syntax and semantics


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 Prolog programming language family