[TYPES] Declarative vs imperative
vl at cs.utexas.edu
Sun Apr 21 10:09:55 EDT 2013
> I would point out that even Prolog can only be understood fully in
> operational terms, e.g. the "cut" operator !, which controls the proof
> search procedure.
Yes, and consequently Prolog is not fully declarative. But there are
other flavors of logic programming, for instance, answer set programming
(ASP, see http://en.wikipedia.org/wiki/Answer_set_programming). ASP
does not include the cut operator. On the other hand, it incorporates
constructs not allowed in Prolog, such as choice rules. It does not have
an operational semantics. In fact, different implementations use very
different algorithms, but they produce the same result for the same program.
The programmer doesn't need to know which implementation is going to be
used. ASP is fully declarative, like functional programming.
Here is how I would characterize the difference between procedural and
imperative programming. A program in an imperative language describes an
algortithm. A program in a declarative language describes a specification.
Department of Computer Science Office: (512) 471-9564
University of Texas at Austin Fax: (512) 471-8885
2317 Speedway, Stop D9500 E-mail: vl at cs.utexas.edu
Austin, TX 78712-1757, USA WWW: http://www.cs.utexas.edu/~vl
More information about the Types-list