Name distinctness and search
Christian Schulte
schulte at ps.uni-sb.de
Fri Jan 18 14:43:55 CET 2002
Yes, that's how it's supposed to be: it is as with variables. A global
variable (name) remains as is when cloning a space, a local variable
(name) is cloned.
The way to preserve identity is to use as it in your first example. If
you really need to create a global name inside a space try to use a
naming service with a port. The following sketch will do the job
declare
Xs % A stream that will have request
P={NewPort Xs} % A port to which the request are sent
% Process the requests
thread
{ForAll Xs proc {$ Request#Answer}
% Ignore Request
Answer = {NewName}
end}
end
% Now the trick
declare
[A B] = {SearchAll fun {$}
X={Port.sendRecv P whatever}
in
choice X [] X end
end}
{System.show A==B}
More details are available in my PhD thesis:
http://www.ps.uni-sb.de/~schulte/papers/ProgrammingConstraintServices.ht
ml
<commercial ad>
A revised version of this will soon appear as Springer LNAI...
</commercial ad>
Cheers
Christian
"David Carter" <d.carter at 2020speech.com> schrieb im Newsbeitrag
news:<a2965j$qbk$1 at grizzly.ps.uni-sb.de>...
> I'm not sure if this is a bug or a feature -- I suspect it's the
latter, in
> which case I'd appreciate any suggestions for a workaround.
>
> If I do
>
> X = {NewName}
> L = {Search.base.all fun {$} choice X [] X end end}
> {Browse {Nth L 1} == {Nth L 2}}
>
> I get "true", as I'd expect.
>
> But if I do
>
> L = {Search.base.all fun {$} X = {NewName} in choice X [] X end end}
> {Browse {Nth L 1} == {Nth L 2}}
>
> I get "false", even though {NewName} is called before the branch
point. So
> presumably Search.base.all is rewriting all the Names it finds in its
> results to distinct new ones? Is there any way to preserve identity in
these
> circumstances?
>
> I'm using Mozart 1.2.3.
>
> Thanks
>
> David
> -
> Please send submissions to users at mozart-oz.org
> and administriva mail to users-request at mozart-oz.org.
> The Mozart Oz web site is at http://www.mozart-oz.org/.
-
Please send submissions to users at mozart-oz.org
and administriva mail to users-request at mozart-oz.org.
The Mozart Oz web site is at http://www.mozart-oz.org/.
More information about the mozart-users
mailing list