[mercury-users] Request for comments on this code

Ralph Becket rafe at csse.unimelb.edu.au
Tue Jul 11 15:46:35 AEST 2006


Here's my two worms' worth:

I've always assumed that the IO state corresponded to a representation
of part of the world, including parts of the state of the computer
running the computation.

When an IO operation is invoked, the universe gets to manipulate the IO
state just before and just after the IO operation is carried out.

That is, when I write

	io.print(..., !IO),

what really happens is

	universe_gets_a_turn(!IO),
	io.print(..., !IO),
	universe_gets_a_turn(!IO),

What the universe does, however, is cc_multi (i.e., for any IO state
there are many possible successor IO states, but we only get one of
them and we can't backtrack.)

Under that interpretation, IO operations should be cc_multi.

However, there is a strong pragmatic argument that allows us to mark IO
operations to be det, namely that it allows us to distinguish between
the cc-ness of our program vs the cc-ness of the universe.

(As far as I'm aware, (di/uo + det) and (cc_multi) both place identical
constraints on my code.)

Is there a problem with this view (i.e., IO is really cc_multi, but we
actually lose something if we don't pretend it's det)?

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