Oz and Mozart Users Mailing List

Re: "or" statement


From: Denys Duchier (Denys.Duchier@ps.uni-sb.de)
Date: Wed Sep 19 2001 - 18:25:33 CEST


luque@info.ucl.ac.be (Luis Quesada) writes:

> I don't understand your comment. I am not suggesting to use the control
> variable in the guards of the conditional but in the guards of the or.
> Would you please have a look at my proposal and tell me what is wrong with
> it?

I never said that that you were suggesting it (the use of `you' was
intended to indicate an unspecified individual, rather than just you
specifically). _One_ should not put a control variable in the guard
of a `cond'. ok?

Apropos your suggested implementation, it has the following 3 problems:

* it duplicates constraints and this is undesirable

* it doesn't actually do what you set out to do, which was to get rid
  of sibling guards once you have decided for one of them. In the
  direction cond->or things are ok, but in the direction or->cond,
  they are not. Suppose you explicitly decide C=2, this does not
  cause the cond to commit to the 2nd alternative... and this brings
  us to the last and damning problem:

* it has confluence problems. This is best explained with an example
  where there are several identical guards. Your implementation would
  look someting like this

thread
  cond X=1 then C=0
  [] X=1 then C=1
  end
end
thread
  or C=0 X=1
  [] C=1 X=1
  end
end

  Now suppose that you explicitly decide C=1. The `or' commits to the
  second clause and thus imposes X=1. Now the `cond' wakes up and
  discovers that at least one of its guards is entailed, which one it
  discovers is impredictable as it depends on concurrency. Suppose,
  it first discovers that its first guard is entailed, then it commits
  to that and attempts to impose C=0, which causes a failure. If it
  had discovered entailment of its second guard first, it would have
  imposed C=1 which succeeds.

Cheers,

-- 
Dr. Denys Duchier			Denys.Duchier@ps.uni-sb.de
Forschungsbereich Programmiersysteme	(Programming Systems Lab)
Universitaet des Saarlandes, Geb. 45	http://www.ps.uni-sb.de/~duchier
Postfach 15 11 50			Phone: +49 681 302 5618
66041 Saarbruecken, Germany		Fax:   +49 681 302 5615
-
Please send submissions to users@mozart-oz.org
and administriva mail to users-request@mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.



This archive was generated by hypermail 2b29.