[Haskell-cafe] Wikipedia on first-class object

Jonathan Cast jonathanccast at fastmail.fm
Fri Dec 28 18:54:52 EST 2007


On 28 Dec 2007, at 1:12 AM, Cristian Baboi wrote:

> On Thu, 27 Dec 2007 17:35:54 +0200, Jonathan Cast  
> <jonathanccast at fastmail.fm> wrote:
>
>
>> Only on Von Neuman machines.  Haskell implementations are not  
>> required to run on Von Neuman machines.  That's why the language  
>> is called functional.  (Imperative languages, by contrast, are  
>> just abstractions of the underlying Von Neuman architecture, which  
>> is probably the source of your confusion).
>
> Can you tell me what is it that make a language imperative ?

Programming languages are generally classified into three groups,  
imperative, functional, and logical.  The difference is in the style  
of programming encouraged (or mandated, for older languages) by the  
language.

In imperative languages, the programmer is encouraged to organize his  
program as a list of fairly small instructions to be executed in  
sequence by the machine.  The archetype here is assembler, whose  
specification is part of the specification of the machine, but other  
languages tend to provide features inspired by computer architecture  
(mutable variables that designate regions of RAM, for example).

In logical languages, the programmer is encouraged to organize his  
program as a set of predicates and axioms for reasoning with them;  
the system then attempts to use the axioms to find a proof of a  
particular assertion within the system.

In functional languages, the programmer is encouraged to organize his  
program as a set of definitions of named expressions, some of which  
will be functions used in other expressions.  The system then  
evaluates one of these expressions and, in purely functional  
languages, `executes' it in some sense (conceptually this step comes / 
after/ the evaluation of the main expression).

Note that the latter of these two have nothing to do with computer  
architecture; functions in a functional language are source code  
expressions that need to be evaluated and that can be referred to in  
larger expressions, not regions of memory containing instructions for  
the computer.

jcc



More information about the Haskell-Cafe mailing list