Logtalk

From Seo Wiki - Search Engine Optimization and Programming Languages
Jump to navigationJump to search
Logtalk

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: <source lang="text"> ?- write('Hello world'), nl. Hello world true. </source>

Defining an object: <source lang="text">

- 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.

</source>

Using the object: <source lang="text"> ?- my_first_object::p1. This is a public predicate true. </source>

Trying to access the private predicate gives an error: <source lang="text"> ?- my_first_object::p2. ERROR: error(permission_error(access, private_predicate, p2), my_first_object::p2, user) </source>

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...