From: Sean Middleditch Date: 2001-12-06T14:02:40+09:00 Subject: [ruby-talk:27624] Re: Sending a Proc to a remote dRuby object There's been (at least) a couple of big threads on this. As I recall, it isn't possible. The best one can do (from what I've read) is send the source code over, and more or less eval() it. The Ruby VM doesn't seem to cleanly seperate bytecode from context well enough to handle this. I'm working on my own scripting language (designed solely for embedding and network apps), and I see now why Ruby works as it does: speed. A few small optimizations to my language and speed beats the tar out of Ruby (in my small tests, anyways, in larger code Ruby's more optimized code will likely win out). But doing so I loose the state saving features and network independence, since I have to tie execution in with both the byte code and context, making state inseperable. On Wed, 2001-12-05 at 23:51, Phil Tomson wrote: > I'm trying to send a proc to a dRuby object running on a remote machine > and then call that proc... > > Here's what I'm got on the 'server' (the remote machine): > #---------------------REMOTE----------------------------- > class TestServer > > def run(&procObj) > puts "got a: #{procObj.type}" > procObj.call > end > > end > require "drb/drb" > ts = TestServer.new > primary = DRb::DRbServer.new("druby://localhost:5555", ts) > puts "TestServer started" > primary.thread.join > #--------------------------------------------------------- > > And here's what I'm running on the local machine: > > # ----------- local ------------ > require "drb/drb" > primary = DRb::DRbServer.new > ts = DRb::DRbObject.new(nil, ARGV.shift) > #try sending a proc: > ts.run { puts "running the Proc" } > #--------------------------------- > > > On the remote machine I get: > > =>TestServer started > =>got a: Proc > > So it gets the Proc, but the call of the Proc seems to do nothing... > (I would expect to see on the remote machine: "running a Proc" in addition > to the above). > > Is it even possible to pass a Proc to a remote dRuby object like this? > > Phil >