Declarative Programming Languages

A declarative programming language is a high-level language that describes a problem rather than defining a solution — it makes use of declarative programming. A declarative programming language says "what", while an imperative programming language says "how". The term is not entirely clear and often controversial; it is sometimes used as a buzzword.

Declarative programming languages can be declarative in a variety of ways. Prolog is declarative in that the programmer states relationships and asks a question about those relationships — without defining how to compute the answer. Functional programming languages are declarative in that functions relate their output to their input — without defining a strict order to evaluate any operations. Data-oriented programming languages and query languages are declarative in that queries are not given in terms of how to find data but instead give criteria for the desired data (SQL is an example).

The distinctions are never sharp; Prolog can be used to compute explicitly, by use of recursive rules and the cut operator. Functions that aren't purely functional or make use of a monad do strictly sequence operations. SQL's INSERT and DELETE commands are dependent on sequence. On the other hand, assembly language, the lowest level of instruction sequences possible, has declarative aspects — static memory allocation and macros, for example.

Declarative Languages

Hosted by www.Geocities.ws

1