Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!amdcad!sun!pitstop!sundc!seismo!uunet!mcvax!ukc!s1!kh From: kh@s1.sys.uea.ac.uk (Kevin Hammond CMP) Newsgroups: comp.lang.prolog Subject: Re: The meaning of "declarative" Summary: Advantages of declarativeness Message-ID: <156@s1.sys.uea.ac.uk> Date: 11 Oct 88 19:48:26 GMT References: <517@quintus.UUCP> Distribution: comp.lang.prolog Organization: UEA, Norwich, UK Lines: 33 In article <517@quintus.UUCP>, ok@quintus.uucp (Richard A. O'Keefe) writes: > I wonder whether there is any virtue in declarativeness as such, or whether > the real issue may not be hidden dependencies within a program? If a language is declarative, then it is possible to apply program transformations in order to gain efficiencies which are not otherwise possible, or to compile for a parallel processor without needing to change (or recompile for the same machine, but different number of processors) the code. Even if the dependencies are up front, and your program is essentially declarative you lose a lot of this potential, and it's hard work for the compiler writer (as I've found from my PhD). For example one single assignment, intended to improve space and time efficiency working under normal assumptions, can actually force a parallel program to run sequentially. Things like higher-order functions or dynamic variables are also very hard to sort out when you allow assignment. I/O has much the same effect as assignment. Note that this isn't to say that an expert armed with an imperative language and the appropriate scheduling constructs (PAR, SEQ etc.) can't write efficient parallel programs, but surely the aim of language designers is to make programming easier and machine independent (and that includes independent of the number of processors available). Declarative languages make this possible, at some cost in compiler-writer time. Incidentally, at Imperial College, London, they have a pure functional language with lazy data structures (infinite lists), called HOPE+, which runs faster than compiled C on a Sun-3, at least for some examples (benchmarking is very emotive so I won't go into details!). -- Wot? No Signature? UUCP: ...!mcvax!ukc!uea-sys!kh JANET: kh@sys.uea.ac.uk