Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!rochester!cornellcs!newsstand.cit.cornell.edu!news.kei.com!newsfeed.internetmci.com!in2.uu.net!munnari.OZ.AU!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: Prolog Types and Modes ...
Message-ID: <9532918.8821@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU (CS-Usenet)
Organization: Computer Science, University of Melbourne, Australia
References: <DII5Iv.DpI.0.-s@cs.vu.nl>
Date: Sat, 25 Nov 1995 07:58:31 GMT
Lines: 42

ctv@cs.vu.nl (ctv) writes:

> We would like to know if there exist tools for
>
> (*) type derivation,
> (*) type checking,
> (*) mode annotations/checking
>
>and similar aspects for "standard" (e.g. Quintus, SICStus, SWI)
>Prolog systems. We're aware of the many new Logic Programming
>related research efforts, however we have to confine ourselves
>to a traditional/standard Prolog framework.

NU-Prolog comes with a type checker.  However, the NU-Prolog type checker
has a fundamental flaw - it doesn't catch all the type errors.

It is very difficult to come up with a good type checker for a language
like Prolog which is historically an untyped language, since almost all
of the existing Prolog code and useful libraries for Prolog make use of
constructs that it is very difficult to allow without also allowing
code which contains genuine type errors.  Mind you, the use of these
untyped constructs is almost always incidental and historical - there
are equivalent typed constructs which are just as easy to use.
Personally, if you think typechecking is important (and I do), then I
think it is better to use a language that was designed for it.

It is however possible to use the Mercury typechecker on Prolog
code, if you write the appropriate type declarations and avoid the use
of Prolog constructs that cannot be well-typed in the Mercury type system.
This would work well if you are writing code from scratch, but is likely
to be very tedious if you are retro-fitting types to existing code.
The Mercury distribution includes support for SICStus Prolog, and it
is possible to just use the Mercury compiler with the `--typecheck-only'
(or `-t') option to typecheck your programs, and use SICStus Prolog
to execute them.  (Support for Quintus and SWI Prolog could probably
be added without too much difficulty, if someone was interested in this.)
Would that qualify as confining yourself to a "traditional/standard Prolog
framework"?

--
Fergus Henderson             	WWW: http://www.cs.mu.oz.au/~fjh
fjh@cs.mu.oz.au              	PGP: finger fjh@128.250.37.3
