From: chr_news@... (chr_news@...) Date: 2001-12-20T06:47:59+09:00 Subject: [ruby-talk:28992] Re: Sending a Proc to a remote dRuby object Robert Feldt wrote in message news:... > On Thu, 6 Dec 2001, Phil Tomson wrote: > > > That would be nice... > > > Check out [ruby-talk:22035]. It is Matju's and Guy Hurst's solution. > > /RobertF Hm interesting pointer - this solution is nice but not free of problems ... ---------- class Proc attr_accessor :source class << self def _load(aString) foo=eval(aString) foo.source=aString foo end end def _dump(aDepth) source or raise "sourceless Proc cannot be dumped" end end module Kernel alias :old_proc :proc def Kernel.proc(string=nil,&b) if string and b then raise "bad argument, dude" end if string then Proc._load("proc{#{string}}") else old_proc(&b) end end def proc(string=nil,&b); Kernel.proc(string,&b); end end bla = "bla is not local to eval" blu = proc %{|| p bla } begin blu[] rescue NameError => mes puts mes # => undefined local variable or method `bla' for Proc:Class end ---------- /Christoph