[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can a functional language be sequential?

["Michael St . Hippolyte" <mash@brooklyndigital.net>]
> On 2003.06.01 17:13 andrew cooke wrote:
> > 
> > as far as i can tell, your programs do have side effects, just as many
> > functional programs have side effects - they change the state of the
> > "world" by doing output operations.  since the order of output is
> > generally important, functional languages need to sequence events just
> > as much as imperative ones.  (ok, i know you probably meant side
> > effects within the program).
> Yes, Bento connects very easily to the outside world, and once you do
> side effects are unavoidable.  This would be true of any functional
> language capable of calling external methods, no?  I'm assuming that
> such real-world exceptions are accepted by real-world functional
> programmers -- it would be hard to do many useful things otherwise.

Hardly. Real-world exceptions are anathema to real-world functional
programmers! ;)

When pure functional programmers say something is without side
effects, they mean side effects OF ANY KIND. Using the term in a less
precise way will certainly get you in hot water in some circles, as
will this:

> If I can state with accuracy "Bento is a functional language like
> Scheme is" I'll be satisfied :)

Pure functional programmers have spent years devising clever ways of
encapsulating effects and keeping them out of their pure functional
code, and they are proud of these techniques. Haskell, for instance,
uses monads to represent and sequence computations with side effects,
thus keeping the core of the language purely functional.

To be fair, purely functional languages are very much the minority,
even among languages calling themselves "functional." The word is more
often used, it seems, to refer to the idiom encouraged by the language
than to indicate a semantic fact. All the same, you may wish to be
careful here...


Matt Hellige                  matt@immute.net