From: Tom Sawyer Date: 2002-08-20T10:26:09+09:00 Subject: Re: drb -- distrib'd ruby and marshalling, question about methods On Mon, 2002-08-19 at 14:57, Armin Roehrl wrote: > Am Montag, 19. August 2002 20:48 schrieben Sie: > > My problem w/ perl serialization is that you cannot serialize code, > > such as methods. My knowledge of Ruby is scant so my question is > > "does Ruby solve this problem ??" > I don't know much about drb, etc. and look forward to be proven wrong :-). > I think you can't as Ruby is C under the hood. What you can do though is > send a "text"-representation of the method from a client to a server > and then use the wonders of "eval". well, drb really serves a slightly different purpose, in that you're remotely executing the methods as if they were local. but you are not actually transmitting serialized methods via the network, you are merely calling them by name, and it is the name that is transmitted. the results of these methods are then serialized and transmitted back. but some objects can't be serialized, since drb, i believe, utilizes Ruby's standard Marshal module. this means bindings, procs, IO objects, and singleton objects won't fly. the suggestion of having your methods sent in text representation form and using eval, isn't the most elegent, but could work. but then you cannot do this via literially defined methods. rather, you have to put them into strings. which gives one pause actually, what is the real distinction between the two? why the execution slow down on evals? and wouldn't it be nice to have a method object dump its contents as a string? and so on... ~transami