[mercury-users] declarative kernels

Gustavo A. Ospina gos at info.fundp.ac.be
Wed Mar 8 04:03:53 AEDT 2000

At 04:18 07/03/00 +1100, you wrote:
> > > What exactly does io__state represent, when it's being
> > > passed to multiple programs by another underlying program?
> >
> > 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.
>Note that in the context of concurrent threads, "external" here should mean
>"external to the current thread", not "external to the program".
>This is an important distinction.

Taking the general model of the "state of the world", if I have for example 

   io__write(a, IO0, IO1),
   io__write(b, IO1, IO2),

How could be explained that the world state IO1 declared in the first write 
_is not the same_ that the state IO1 in the second write (other programs, 
or someone, could be modifying the entire world between the two instructions)?

But I suppose this is not the most problem with this model.

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

A more painful example. The IO state passed between the two operations has 
changed and it seems there are a single way to "declare" that in this model.

>The semantics of every primitive I/O operation is:
>         - delay for some unspecified period of time
>           (during which the state may change due to the effect
>           of other threads, other processes, etc.)
>         - then perform the primitive I/O operation
>         - then delay for another unspecified period of time

I suppose this is another main raison for the impossibility of "backtrack" 
between states of the world. The io__state has parameters which the program 
cannot control (e.g. files opened by others process or threads). In fact, 
the program just controls the files (devices, etc) it has opened (including 
standars streams).

An idea we had to mix processing and input over a data structure is to make 
explicit the backtracking. This is made transforming the data structure and 
the processing algorithm using some transformation rules to reduce the non 
determinism, and make explicit a step of back-track.

Excuse me for my english, I will elaborate deeper my ideas in the next time.

+ Gustavo.

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