cond and stability

Luis Quesada luque at info.ucl.ac.be
Tue Jan 24 08:34:06 CET 2006


Jorge.Pelizzoni at loria.fr wrote:
> Hi, all! During some experiments I found a behaviour of cond during search that
> I cannot explain. It looks like a bug to me. Can anyone please explain the
> difference between the two calls to ExploreAll in the following:
> 
> --------------------------------------
> declare
> proc {F S}
>    C
> in
>    S = {FS.var.upperBound [1#20]}
>    C = ({FS.card S} <: 2)
>    thread
>       cond
> 	 C = 1
>       then
> 	 {Browse here}
> 	 case {FS.reflect.upperBound S} of
> 	    [X] then {FS.include X S}
> 	 else skip end
>       end
>    end
>    {Space.waitStable}
>    {FS.subset S {FS.value.make [1]}}
> end
> proc {F2 S}
>    C
> in
>    S = {FS.var.upperBound [1#20]}
>    thread
>       cond
> 	 {FS.card S} <: 2
>       then
> 	 {Browse here}
> 	 case {FS.reflect.upperBound S} of
> 	    [X] then {FS.include X S}
> 	 else skip end
>       end
>    end
>    {Space.waitStable}
>    {FS.subset S {FS.value.make [1]}}
> end
> 
> {ExploreAll F}
> {ExploreAll F2}
> ----------------------------
> 


I think that the reason is the same that justifies the difference in the 
following cases:

{Space.new proc {$ _}
	      S = {FS.var.upperBound [1]}
	      C = ({FS.card S} <: 2)
	   in
	      thread
		 Sp={Space.new proc{$ _} C = 1 end}
	      in
		 {Browse {Space.ask Sp}}
	      end
	   end _}

{Space.new proc {$ _}
	      S = {FS.var.upperBound [1]}
	   in
	      thread
		 Sp={Space.new proc{$ _} {FS.card S} <: 2 end}
	      in
		 {Browse {Space.ask Sp}}
	      end
	   end _}

In the second case you wait until S is bound.

Cheers,
Luis




More information about the mozart-users mailing list