[mercury-users] Libraries and DCG convenience...

Thomas Conway conway at cs.mu.OZ.AU
Wed Jun 23 11:55:25 AEST 1999


On Wed, Jun 23, 1999 at 10:55:21AM EST, Peter Schachte wrote:
> I suspect there are a number of Mercury predicates extant which would
> be clearer if they just threaded the io__state, rather than trying to
> use DCGs.  But there seems to be an unstated assumption that if a
> predicate takes a pair of io__states, then it should be written as a
> DCG.  Almost as if io_states should never be seen in actual code (just
> in the declarations).

I've written quite a bit of code where I use "natural"
argument threadding for the IO state (often because I've
got some more important state to thread). For example
in a Prolog interpreter I wrote in my hons year, the
only predicates that did any IO were the builtins and the
execution loop (for the 4-port debugger). The bulk of
the interpreter actually used a DCG argument pair to
thread the state of the interpreter (eg the current substitution,
choice point stack, etc).

> > One of the things I like about Clean is not just that it lets
> > you write a function Start :: *World -> *World, but that it
> > lets you break a World into pieces and pass the pieces around
> > *separately*.
> 
> Yes, this does seem like a nice idea.  In fact, it's applicable to any
> type which can be divided into independent bits, eg, destructive
> arrays.  This would be very nice to have in Mercury.

I thought so too for a while. What happens (or more importantly,
what are the semantics) where I open a file for reading and
somewhere else open the same file for writing (for example) -
assuming that the latter truncates the file, then I care very
much what ordering of IO operations I get in an absolute
sense.

-- 
 Thomas Conway )O+     Every sword has two edges.
     Mercurian            <conway at cs.mu.oz.au>
--------------------------------------------------------------------------
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