Using Reified Constraints

Luis Quesada luque at info.ucl.ac.be
Mon Jan 23 18:02:01 CET 2006


Raphael Collet wrote:
> Harmon Nine wrote:
> 
>> The proc, as it is involved in FD constraints, creates a "space."  A
>> space can only modify variables that are created locally within it
>> (here, created within the proc).  Any variables created outside the
>> space (i.e. outside the proc), but the space still has access to (via
>> closure), are read-only.
> 
> 
> Well, the story is slightly more complicated...  A thread inside a space 
> can bind a variable created outside that space, but the binding is not 
> visible outside the space.  In other words, the space is allowed to 
> "speculate" on the variable's value.  The speculation is like a local 
> assumption made by the space only. [...]


Indeed, due to the fact that you can bind the variable inside the space, 
you can detect failures in cases where the variable is not bound outside 
yet:

declare X
S={Space.new proc {$ _}
		X::2#3
		X=1
		{Show X}
	     end}
{Browse {Space.ask S}}

Notice that in the previous case Space.ask doesn't need to wait for the 
global determination of X. The value to which X is bound outside won't 
change the situation of the space

Luis




More information about the mozart-users mailing list