[TYPES] Declarative vs imperative

Rishiyur Nikhil nikhil at acm.org
Mon Apr 22 11:53:04 EDT 2013


>    ... 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.

But one man's specification is another man's algorithm.  Even in Haskell,
one writes a sorting program typically by choosing a particular
algorithm (heap sort, quick sort, ...).  Sure, these can be considered
specifications of sorting, but they are hardly the most abstract spec
for sorting.

Similarly, a C program is a specification for a hundred different
machine code algorithms that manage memory, register allocation etc.

Nikhil


More information about the Types-list mailing list