[mercury-users] declarative kernels

Ralph Becket rbeck at microsoft.com
Mon Mar 6 21:22:26 AEDT 2000


> From: Thomas Conway [mailto:conway at cs.mu.OZ.AU]
> 
> There are two interpretations of the io__state.
> 
> The first, proposed by Fergus, is that the io__state 
> represents the state
> of the external world, and that I/O operations modify the 
> external state.
> This has the drawback that if, for example someone else on the system
> removes a file between when you finished writing it, and when 
> you go to
> read it again, then the act of closing the file has to 
> implicitly remove
> it as well, which is a bit strange, but it is a fairly simple model.

Oh, that's not my interpretation of what Fergus said.  I thought Fergus
was advocating the idea of an io__state being a *view* of the external
world - that is, it keeps track of what your program has attempted to do
to the outside world, rather than being a reflection of the actual state
of the outside world.  This means that just because you wrote something 
to a file, there's no guarantee that that's what you'll read back in.

> More recently I proposed an interpretation that owes a lot to 
> concurrent
> logic programming, where the io__state represents a list of 
> interactions
> with the external world. The io__state pair represents a 
> difference list
> (in the Prolog sense), with the second io__state representing the I/O
> operations that come "after".

This is an appealing picture, but I don't see how it takes exogenous
events into account (e.g. someone else unexpectedly deleting a file).
Unless, of course, your_main/2 below is the merge of everybody else's
IO operations, too.

> ?- my_main(IO0, []), your_main(IO1, []), merge(IO0, IO1, IO), 
> do_io(IO).

Ralph
--------------------------------------------------------------------------
mercury-users mailing list
post:  mercury-users at cs.mu.oz.au
administrative address: owner-mercury-users at cs.mu.oz.au
unsubscribe: Address: mercury-users-request at cs.mu.oz.au Message: unsubscribe
subscribe:   Address: mercury-users-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------



More information about the users mailing list