Logtalk

From Seo Wiki - Search Engine Optimization and Programming Languages
Jump to navigationJump to search
Logtalk
Paradigm Logic programming
Appeared in 1998
Designed by Paulo Moura
Influenced by Prolog, Smalltalk, Prototype-based programming, Object-oriented programming, Logic programming
OS Cross-platform
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[1]. It provides support for encapsulation and data hiding, separation of concerns and enhanced code reuse.[2] Logtalk uses standard Prolog syntax with the addition of a few operators and directives.

It is distributed under an open source license and can run using most Prolog implementations as the back-end compiler.

Features

Logtalk aims to bring together the advantages of object-oriented programming and logic programming[3]. 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.

Examples

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.

See also

External links

References

  1. Paulo Moura (2003). Logtalk: Design of an Object-Oriented Logic Programming Language. PhD thesis. Universidade da Beira Interior
  2. ibid p.2
  3. ibid p.2

pt:Logtalk

If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...