[mercury-users] Request for comments on this code

Peter Schachte schachte at csse.unimelb.edu.au
Thu Jul 13 09:52:54 AEST 2006


On Wed, Jul 12, 2006 at 02:50:56PM +1000, Ralph Becket wrote:
> by labelling IO
> operations as det we are quietly assuming a deterministic universe,
> whereas I believe it has been proved that the universe is fundamentally
> probabilistic.

I always thought of the determinism of a predicate as describing
*that* predicate's behavior.  So

	write("Hello World!", !IO)

being det should just mean that write/3 behaves deterministically, it
shouldn't have to promise anything about the universe, any more than
it should have to promise that you won't run out of memory or suffer a
power failure while executing it.  It really should just describe the
success set of the predicate given the mode.

Of course, Ian's right that for any operation that effects with the
universe, the state of the universe after it depends on the operation,
the state of the universe before it, *plus* whatever else the universe
happens to do concurrently.  So the whole "threading the state of the
world" idea is a pretty crude approximation.  It doesn't even work if
we just take the state of the world to include only the files we're
manipulating, because someone can alway write to the same file we are
concurrently.

The only model I know that really has a chance of working is to think
of an IO state pair as difference list of messages we send to the
universe.  So main/2 simply describes the IO commands the program
executes while it's running; nothing more.  This doesn't require us to
say anything about what the universe actually does with those
messages.  Interestingly, it's also much closer to the Haskell view.

-- 
Peter Schachte              The significant problems we face cannot be
schachte at cs.mu.OZ.AU        solved by the same level of thinking that
www.cs.mu.oz.au/~schachte/  created them.
Phone: +61 3 8344 1338          -- attributed to Albert Einstein 
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at csse.unimelb.edu.au
administrative address: owner-mercury-users at csse.unimelb.edu.au
unsubscribe: Address: mercury-users-request at csse.unimelb.edu.au Message: unsubscribe
subscribe:   Address: mercury-users-request at csse.unimelb.edu.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list