Re: Prolog module system



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

.



Relevant Pages

  • Re: Prolog module system
    ... to define a module *interface* that can be implemented (and therefore ... In the context of module systems ADTs are senseless for Prolog ... if Prolog doesn't even support concrete data types. ...
    (comp.lang.prolog)
  • Re: replacing X Window System !
    ... just with some implementations. ... interface or most inter-application communication. ... Lack of application support (which requires backwards compatibility) is ...
    (Linux-Kernel)
  • Re: Collection vs well defined transfer objects
    ... > I am not advocating that complex data types be split up into basic ... > object in the Map or two different Integer objects in the Map. ... > interface of my class, as the parameter checking has now been pushed ... Transfer Object, adding or removing a parameter from the request will ...
    (comp.object)
  • Re: Cohens paper on byte order
    ... > interoperate with all other corect implementations, ... What I meant by this is that if implementations were to formally encode AES ... work with those that now exist since these all use an octet array interface. ... tidying up a small hole in the FIPS. ...
    (sci.crypt)
  • Re: .NET DES CFB - useless interface?
    ... The problem is that the cryptography namespace provides an ICryptoTransform ... interface, ... the cipher mode code and padding code could have ... implementations, but as it is now, you have to re-code it with every managed ...
    (microsoft.public.dotnet.security)