Re: Prolog module system
- From: Paulo Moura <pjlmoura@xxxxxxxxx>
- Date: Mon, 11 Jun 2007 15:17:49 -0700
On Jun 11, 9:34 pm, bart demoen <b...@xxxxxxxxxxxxxx> wrote:
On Mon, 11 Jun 2007 13:58:15 -0700, Paulo Moura wrote:
On Jun 11, 8:26 pm, bart demoen <b...@xxxxxxxxxxxxxx> wrote:
I think it would make a lot of sense to give types to Prolog
before giving it abstract data types.
In the context of module systems (which is the topic of this thread
and the context of my comment), ADTs can be translated to being able
to define a module *interface* that can be implemented (and therefore
reused) by *several* independent modules.
Maybe I should have been more explicit.
In the context of module systems (...) ADTs are senseless for Prolog
if Prolog doesn't even support concrete data types.
I disagree. Consider, for example, the "dictionary" ADT. You can
implement dictionaries in Prolog using e.g. different types of trees.
With support for separating interface from implementation in a
encapsulation mechanism, you can *declare* predicates for working with
this ADT (e.g. empty/1, insert/4, lookup/3, keys/2, etc) in a
interface/protocol and then provide different *implementations* for
these predicates in different modules/objects, each one implementing a
dictionary data structure with its own set of trade-offs. Different
implementations can then coexist in the same application. Switching
implementations is easy as all of them use the same interface. This is
common practice in modern OOP languages. You can also do it in Prolog
by using Logtalk. While you (may) regard this as senseless, me and
others are happily taking advantage of this features :-)
All the best,
Paulo
.
- Follow-Ups:
- Re: Prolog module system
- From: bart demoen
- Re: Prolog module system
- From: Jan Wielemaker
- Re: Prolog module system
- References:
- Re: Prolog module system
- From: Mauro Di Nuzzo
- 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
- 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
|
|