Dear Raphael,

Great, thanks a lot (I should have figured out the Module issue myself..). It works now!

Anyway, one last question: what does the warning "Unable to reach the net, using localhost instead" mean?

Thank!

Best
Torsten

On 25 Mar 2009, at 15:52, Raphael Collet wrote:

Dear Torsten,

2009/3/25 Torsten Anders <[email protected]>
Dear Raphael,

Thank you for your explanation! I now understand (hopefully) what the problem is in principle. Nevertheless, I am stiff too dense to get my dummy example running after your explanation. Should I import ressources within the functor for the script or even within the script itself?

You should import it in the functor. The script should not access some global state (like Module).

Nevertheless, even if I define my class in a functor and then link/ apply this functor only within the script I get the error below, so the class is seemingly still some unusable resources. What am I missing? Also, why do I get the warning "Unable to reach the net, using localhost instead" -- this machine certainly has network access.

I suspect the unusable resource is in Module itself! Module is not part of the language definition, and you should import it as well :-)

Here is how you should modify your example:

declare
%% dummy functor with class
functor MyDataF
import
   FD
export
   MyClass
define
   class MyClass
      attr val
      meth init(val:?Val<={FD.decl})
         @val = Val
      end
      meth val($) @val end
   end
end
Machines = init(localhost:2)
functor ScriptF
import
%% Any ressources except from the Oz base environment must be treated explicitly for distribution: import any functor needed (FD, MyData) within the functor/script
   FD
Module % Module is a resource, and we need it to apply MyDataF

export Script
define
%% get module MyData from functor MyDataF (the functor itself is resource-free, so we can access it)
   [MyData] = {Module.apply [MyDataF]}

   %% dummy script
   proc {Script Root}

      X = {New MyData.myClass init}
      Y = {New MyData.myClass init}
      Z = {New MyData.myClass init(val: 7)}
   in
      Root = unit(X Y Z)
      %% Avoid constraint equation syntax in distributed programs
      {FD.sum [{X val($)} {Y val($)}] '=:' {Z val($)}}
      {FD.less {X val($)} {Y val($)}}
      %%
      {FD.distribute ff [{X val($)} {Y val($)}]}
   end
end
%% create search engine for two processes on localhost
SearchEngine = {New Search.parallel Machines}
Solution = {SearchEngine one(ScriptF $)}

Here you are, you were pretty close.  I think it should work, now.

Cheers,
raph

<ATT00001.txt>

_________________________________________________________________________________
mozart-users mailing list                               
[email protected]
http://www.mozart-oz.org/mailman/listinfo/mozart-users

Reply via email to