[mercury-users] declarative kernels
Fergus Henderson
fjh at cs.mu.OZ.AU
Wed Mar 8 17:46:45 AEDT 2000
On 07-Mar-2000, Gustavo A. Ospina <gos at info.fundp.ac.be> wrote:
> 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
> this,
>
> 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)?
In my interpretation, the variable IO1 refers to the exact same state
in both places. So the world state is _not_ different.
In my interpretation io__write is implemented as
io__write(X, State0, State) :-
io__delay(State0, State1),
io__really_write(State1, State2),
io__delay(State2, State).
and the effect of other programs modifying the world state between the
two calls to io__write does not mean that IO1 has two different
values at different times, it just means that inside the second
call to io__write, the value of State0 is not the same as State1.
> 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).
Yes... an example that we commonly used was that it is very difficult
for an implementation to get the ink off the paper once it has come
out of the printer ;-)
--
Fergus Henderson <fjh at 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 at 128.250.37.3 | -- the last words of T. S. Garp.
--------------------------------------------------------------------------
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