world as value

Fergus Henderson fjh@cs.mu.OZ.AU
Tue, 15 Jun 1999 22:43:37 +1000


On 14-Jun-1999, Martin Wierich <martinw@cs.kun.nl> wrote:
> I want to start a discussion about Clean's "world as value" paradigm.
...
> My problems with the world as value paradigm arise from the fact, that
> the world is not only changed by a Clean program, but also changes
> itself independently.

The solution to this problem is to say that the semantics of each
individual I/O operation provided by the standard library is to
(1) delay some unspecified amount of time (thus creating a new world,
reflecting the side effects of any other programs running concurrently,
and the changes in the state of clocks and other time-dependent
hardware in the world) and then (2) do the operation.

Nondeterminism (e.g. delaying by an unspecified amount of time)
is OK in functions that take and return a world, since the
nondeterminism can conceptually be obtained by examining some
component of the world (the Dow Jones index, say, or some other
source of randomness or arbitrariness, such as the bytes of the
machine code being executed).

P.S. This topic was discussed in some detail in comp.lang.functional a
couple of years ago.  You might still be able to dig that discussion up
if you search at www.dejanews.com.

-- 
Fergus Henderson <fjh@cs.mu.oz.au>  |  "I have always known that the pursuit
WWW: <http://www.cs.mu.oz.au/~fjh>  |  of excellence is a lethal habit"
PGP: finger fjh@128.250.37.3        |     -- the last words of T. S. Garp.