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

Ralph Becket rafe at csse.unimelb.edu.au
Tue Mar 6 11:15:07 AEDT 2007


Peter Schachte, Tuesday,  6 March 2007:
> If you accept my semantics for !X := Term, they are logically equivalent.  My
> point is that it's pretty natural to expect to replace the first sequence with
> something similar looking that replaces both x and y in one go.  It's a bit
> surprising to instead have to replace !Pos ^ x := 7, !Pos ^ y := 42 with !:Pos
> = position(7,42).  Whoa!  Why does the colon jump to the left like that when I
> want to replace the whole term?  Why doesn't it look similar?

(1)
	!Pos ^ x := 7,
	!Pos ^ y := 42
<=>
	!:Pos = !.Pos ^ x := 7,
	!:Pos = !.Pos ^ y := 42

You are proposing that

(2)
	!Pos := position(7, 42)
<=>
	!:Pos = position(7, 42)

In (1), there is a connection between the original and final states of
Pos; in (2) there is not.

Adopting (2) means adding yet another special rule for reading state
variable code.  Moreover, it's a rule that flaunts the understanding
that !Pos relates successive values of (the sequence) Pos.

> I'm arguing that !X ^ x := Term1 is a special case of !X := Term2, where Term2
> is like the original term, but with its x component replaced with Term1.  You
> and Julien see it as something completely different.  I think this difference
> in perspective is because I want to think of !X as a different sort of
> "variable" that has a sequence of possibly different values throughout the
> clause, whereas I gather you want to think of it as standing for a different
> pair of variables in each place it occurs.  That view actually doesn't accord
> well with the !X ^ x := Term syntax very well at all, whereas mine does.

This is debatable.

> To me, the best thing about the !X notation is not avoiding having to
> write X1, X2, X3,... throughout the clause.  The best thing is having
> a simpler mental model, and simpler syntax, for having a value evolve
> through the execution of a clause.  This is something imperative
> languages do well, since it's their foundation, so it seems reasonable
> to pinch their syntax.

If we were to pinch their syntax we would also be able to pass !X where
a single argument is expected.  How could this be made to work?

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