Content area
Full text
Introduction In recent times there has been a great increase in interest in what are known as 'declarative programming languages'. These languages are conceptually very different from conventional 'imperative' languages such as Pascal and C. Imperative languages are closely linked with the computational mechanism on which they are implemented. Declarative languages, in contrast, are based on sound mathematical formalisms completely independent of the underlying structure of the machinery on which they are running. As a result programming in declarative languages should no longer be a matter of constructing a series of instructions manipulating the internal state of a machine, but, instead, is reduced to a matter of expressing the problem to be solved in terms of the given mathematical formalism. In addition, the mathematical well-foundedness of these languages makes program transformation and manipulation possible, as well as formal verification. Also their independence of the von-Neumann model of computation lends them naturally to parallel evaluation. These and other advantages mean that the next generation of computer systems will almost certainly be based upon declarative languages. There are currently two main approaches to declarative languages? 'functional programming languages', such as Hope and Miranda, which derive their semantics from the lambda calculus, and 'logic' or 'relational' programming languages, such as Prolog, which are based on first order Horn-clause logic interpreted in a procedural manner. In this essay I will give a comparison of these two paradigms and try to suggest ways in which they might be improved and the advantages of one might be incorporated into the other. I will assume a basic knowledge of the concepts of the two paradigms. In addition, I will discuss the 'object-oriented programming' paradigm which, while not inherently declarative, incorporates many interesting ideas which could usefully be included in future declarative languages. I will not attempt to give a complete, or even balanced, overview of the subjects covered, but merely to put forward various ideas and points of view that I feel are of particular interest. A comparison of the logic and functional programming paradigms Notation There is an immediately noticeable syntactic difference between the two paradigms in that functional programs have their outputs defined implicitly as the right-hand side of the equations defining the program, while logic programs have them named...





