From: ptkwt@...1.aracnet.com (Phil Tomson) Date: 2001-12-04T06:01:45+09:00 Subject: [ruby-talk:27368] thoughts for future Ruby with bytecode VM from the brainstorm department.... I'm working on a task distribution system which distributes runnable objects (objects which respond to a 'run' method) to various clients. One thing I've had to do was define a 'remote_require' method on the clients so that I can send new runnable class definitions to clients so that they are 'aware' of new classes which the user might create (basically, I 'stringify' the rb file which defines the class, send the string to the client and the client does an Object.class_eval(str) ) In the future, when Ruby's backend is some kind of VM that executes bytecode, it would be nice to be able to access the bytecodes which a particular class was compiled to so that the bytecode could be sent around instead of the actual text (assuming the bytecode is more compact than the text description - maybe not true). So we'd have some method defined in Module or Class which is called something like: bytecode, which returns the bytecode definition for the class or module. Maybe we would even have a new object type: Bytecode #a.rb class A def initialize end #... def method #blah dosomething end end #main.rb require 'a.rb' #now we 'know' about class A classAbytecode = A.bytecode #later, after a remote client is set up: client.remote_require(classAbytecode) #now the remote client will 'know' about class A ######end main.rb ######## BTW: maybe it would be nice to be able to access the definition of a class (as a string, without comments) as well (could this be done in the current version of Ruby): #main2.rb require 'a.rb' #from above classStr = A.definition puts classStr => "class A def initialize end def method dosomething end end" Phil