From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-12-06T18:52:46+09:00 Subject: [ruby-talk:27665] Re: Sending a Proc to a remote dRuby object In article , Phil Tomson wrote: >In article , >Robert Feldt wrote: >>On Thu, 6 Dec 2001, Phil Tomson wrote: >> >>> Is it even possible to pass a Proc to a remote dRuby object like this? >>> >>This is a "classic" q so if its not in the FAQ we should probably move it >>there. Procs and Threads (and some other type of objects) cannot be >>marshaled so dRuby will have problems... ;-) Maybe we should list which >>classes are affected in the FAQ? > >This is what I thought, but why does this example work: > >#----remote object ------------ >require "drb/drb" >primary = DRb::DRbServer.new("druby://localhost:5555", [1,2,3,4,5]) >primary.thread.join > >#----local-------- >require "drb/drb" >primary = DRb::DRbServer.new >ts = DRb::DRbObject.new(nil, ARGV.shift) >#try sending a proc: >ts.each { |i| puts i } > >#prints, on local machine: >1 >2 >3 >4 >5 > >(I suppose the answer has soemthing to do with the proc executing on the >local machine.) Oh, of course, now I see it (everything is getting a bit slow at 2AM) - the proc isn't being passed in this case. A variable is being yeilded to it from the remote Array object's each method - right? Phil