[m-rev.] For review: State-variable record update transformation

Peter Schachte schachte at csse.unimelb.edu.au
Tue Mar 6 11:18:41 AEDT 2007


Julien Fischer wrote:

>> There are lots of ways I can
>> replace
>> the value of a state thread using only the !X (not !:X) notation.
> 
> What do you mean by "replace"?  If you mean replace without reference to
> the previous state, no there are not that many ways.

	:- pred :=(T::in, T::out, T::in).
	:=(_, X, X).

	..., !X := position(7,42), ...

I can even do it with your version of the := syntax:

	:- type pointless(T) ---> pointless(value::T).

	% !X is of type pointless(position)
	..., !X ^ value := position(7,42), ...

but it's all pretty pointless :-b

> So whereas !Position usually denotes an expansion into !.Position,
> !:Position (in some way)

See my reply to Jonathan.  I really don't care what it usually expands to, I
care what it means.

> (And since ':=' is just decomposing into '=' in the above goal, why
> choose '!:' as opposed to '!.'?)

Because unifying with !.X doesn't change the value of the state variable, while
mentioning !:X does.  If you must think of it in terms of implementation:
because a goal with no occurrence of !:X interprets !.X as referring to the
same logic variable as it did before and after that goal, whereas a goal with
no occurrence of !.X does not necessarily interpret !:X as the same variable as
it did before and after that goal.  But we're quibbling about implementation; I
think semantics is much more important.

-- 
Peter Schachte              You can fool all of the people some of the time;
schachte at cs.mu.OZ.AU        you can fool some of the people all of the time,
www.cs.mu.oz.au/~schachte/  but you can't fool all of the people all of the
Phone: +61 3 8344 1338      time. -- Abraham Lincoln
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list