Re: Prolog module system
- From: Paulo Moura <pjlmoura@xxxxxxxxx>
- Date: Mon, 18 Jun 2007 03:20:29 -0700
On Jun 16, 7:23 pm, "Mauro Di Nuzzo" <pico...@xxxxxxxxx> wrote:
Wow! This discussion is really charming for I am learning much (actually,
this sharpens my opinion).
...
On the other hand, when I came to Prolog as a logic programming language, I
expected a great part of such a language dealing with categories. Objects
must have a part in Prolog, but I do not believe that a "standard" oop can
improve Prolog (actually I think the contrary). Prolog is based on
predicates and unification.
For non-trivial Prolog applications, you need encapsulation and reuse
mechanisms, wence all the variations of Prolog module and object
systems developed so far.
Consider the length/2 predicate. Logtalk
definition is identical to standard prolog (I cannot see the advantage,
sorry). Instead, within my oop, I define a length/1 predicate, the actual
list (i.e. data) being stored elsewhere in the instance.
You can do the same within Logtalk and write queries such as:
| ?- [1, 2, 3]::length(L).
L = 3
yes
See the "examples/parametric" example.
But consider now
what definition one could use for append/3 (unless using 3 different
predicates). [I hope I expressed myself in the latter point]. So, if data
must remain into the predicate (as an argument), why oop?
Code (i.e. predicates) encapsulation and reuse.
All the best,
Paulo
.
- Follow-Ups:
- Re: Prolog module system
- From: Mauro Di Nuzzo
- Re: Prolog module system
- References:
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: bart demoen
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: bart demoen
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: bart demoen
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: A . L .
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: Jan Wielemaker
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: Joachim Schimpf
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: Jan Wielemaker
- Re: Prolog module system
- From: Joachim Schimpf
- Re: Prolog module system
- From: Paulo Moura
- Re: Prolog module system
- From: Mauro Di Nuzzo
- Re: Prolog module system
- Prev by Date: Re: Prolog module system
- Next by Date: Re: Prolog module system
- Previous by thread: Re: Prolog module system
- Next by thread: Re: Prolog module system
- Index(es):
Relevant Pages
|
|