Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!nntp.club.cc.cmu.edu!hudson.lm.com!news.pop.psu.edu!psuvax1!uwm.edu!math.ohio-state.edu!caen!msunews!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!cs.mu.OZ.AU!munta.cs.mu.OZ.AU!fjh
From: fjh@munta.cs.mu.OZ.AU (Fergus Henderson)
Subject: Re: In defense of Prolog's dynamic typing
Message-ID: <9434510.4744@mulga.cs.mu.OZ.AU>
Sender: news@cs.mu.OZ.AU
Organization: Computer Science, University of Melbourne, Australia
References: <3aviu6$7dq@hitchcock.dfki.uni-sb.de>	<PEREIRA.94Nov23222128@alta.  research.att.com>	<3b1q1v$kqu@hitchcock.dfki.uni-sb <3bd71u$o89@rhino.cis.vutbr.cz>
Date: Sat, 10 Dec 1994 23:29:21 GMT
Lines: 36

Pavel Vana <Pavel.Vana@mff.cuni.cz> writes:

>static typing implies [...] headached programmers
>
>	(how often you change your Goedel programs, or reuse the code
>	 in modules - not at module level ?
>	 I think that most changes in "clauses" imply also many
>	 changes in "types". I thing that this is the major drawback
>	 of static typing)

I've heard several people make this point - that type declarations
supposedly make maintenance more difficult, because you may need to
change the type declarations too.  But my experience is very much
the opposite - type declarations make maintenance much *easier*.

In Prolog, modifications such as adding a new argument to a predicate,
changing the order of arguments to a predicate, or changing the
way data is represented all require careful and painstaking searches
through the entire source code to find every place where that
predicate is called or where that data structure is used.
The process is slow, tedious and very error-prone.

In Mercury I regularly make program modifications that would be
extremely difficult without the compiler's help.  The type-checker can
quickly pinpoint all the parts of the program that need modifying as a
result of a change.  I often still use "grep" to help locate those
parts before running the program through the compiler, but I can do it
*much* more quickly and easily since I know that if I make a mistake,
the compiler will find it for me anyway.

In Prolog, I find that maintenance gets very difficult when the program
gets larger than a couple of thousand lines, but in Mercury I (and others)
can maintain a program 20 times that size without nearly as much difficulty.

-- 
Fergus Henderson - fjh@munta.cs.mu.oz.au
