Hello,

===============About proxies=================
When a proxy is made from a function, what happens to side-effects?

Eg1:

    val myCh1 = Channel.channel();Channel.put(myCh1,1);Channel.put(myCh1,2);
    Channel.put(myCh1,3); Channel.put(myCh1,4);

    fun g = Channel.put(myCh2, (Channel.get myCh1)*10);
    val g1 = Remote.proxy g;

Here both g and g1 behave the same way.

Eg2:

    fun f a b = (a:=b)
    val f1 = Remote.proxy f;

    val a = ref 2;
    val _ = f a 3;  (* a is now ref 3 *)
    val _ = f1 a 4; (* a is still ref 3 *)

Here, f and f1 have different behaviours, because of the cloning bit  
of proxies.

Am I right in my understanding that proxies will not affect the  
side-effects; by side-effects, i mean something like Eg1, wherein data  
is being read from a channel/data is being put into a channel.

===============About Remote execution=================

I have an agent which has the following functionality:

Takes:  (n, s1, s2)
Take an integer(n), read something off a channel (given by the ticket : s1)
do some work and post something to another channel (given by the ticket : s2)

The agent has the following signature:

signature MY_AGENT =
sig
    val doJob :  int -> string -> string -> unit
end

structure myAgent : MY_AGENT =
struct
...
end

I want to offer this as a service that can be remotely invoked.
Here is what I did:


structure myAgentProxy  =

     Remote.Proxy (signature S = MY_AGENT

                   structure X = myAgent

                   )


val myAgentProxyComp = Component.fromPackage (pack myAgentProxy :MY_AGENT);

val hosts = ["h1","h2"]
val myAgentList =
List.map
( fn h =>
   let
    structure s1 =
    spawn unpack Remote.run (h, myAgentProxyComp):
     (val doJob :  int -> string -> string -> unit)
   in
     s1.doJob;
   end
   )

Now, doing
val _ = List.nth(myAgentList, 0) 2 t1 t2

does not run the function on h1, but in the host where myAgentProxy  
was made ??

Can someone please help with a standard idiom that can be used for such
scenarios?

I have seen the example of remote database in here:
http://www.ps.uni-sb.de/alice/manual/distribution.html#remote

Many Thanks,
Sripriya









-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



_______________________________________________
alice-users mailing list
[email protected]
http://www.ps.uni-sb.de/mailman/listinfo/alice-users

Reply via email to