From Seo Wiki - Search Engine Optimization and Programming Languages
|Designed by||Paulo Moura|
|Influenced by||Prolog, Smalltalk, Prototype-based programming, Object-oriented programming, Logic programming|
|License||Artistic License 2.0|
Logtalk is an object-oriented logic programming language that extends the Prolog language with a feature set suitable for programming in the large. It provides support for encapsulation and data hiding, separation of concerns and enhanced code reuse. Logtalk uses standard Prolog syntax with the addition of a few operators and directives.
Logtalk aims to bring together the advantages of object-oriented programming and logic programming. Object orientation emphasizes the development of discrete, reusable units of software, while logic programming emphasizes the representation of our 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, parametric objects, protocols (interfaces), categories (mixins, aspects), multiple inheritance, event-driven programming, high-level multi-threading programming, reflection, and automatic generation of documentation.
For Prolog programmers, Logtalk provides predicate namespaces (supporting both static and dynamic objects), private, protected, and public object predicates, separation between interface and implementation, much better portability than Prolog modules, simple and intuitive meta-predicate semantics and lambda expressions.
Logtalk's syntax is based on Prolog:
?- write('Hello world'), nl. Hello world true.
Defining an object:
:- object(my_first_object). :- 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:
?- 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)
Prolog backend compatibility
As of October 2009, supported back-end Prolog compilers include Amzi! Prolog, B-Prolog, Bin-Prolog, Ciao, CxProlog, ECLiPSe, GNU Prolog, IF Prolog, JI-Prolog, K-Prolog, Open-Prolog, Qu-Prolog, Quintus Prolog, SICStus Prolog, SWI-Prolog, XSB, and YAP Prolog.
- ↑ Paulo Moura (2003). Logtalk: Design of an Object-Oriented Logic Programming Language. PhD thesis. Universidade da Beira Interior
- ↑ ibid p.2
- ↑ ibid p.2