[Ruby] marshalling lambdas

Ryan Davis ryand-ruby at zenspider.com
Fri Aug 22 14:17:55 PDT 2008


On Aug 22, 2008, at 13:51 , Phil Hagelberg wrote:

> You could probably do better with ruby2ruby though; I'm not that
> familiar with the lib. But yeah, serializing code is built-in to lisp.
>
> Here's how to do it in Bus Scheme:
>
>> (send (lambda () (+ 2 2)) 'inspect)

501 % irb
 >> require 'rubygems'
=> true
 >> require 'ruby2ruby'
=> true
 >> proc { 2 + 3 }.to_ruby
=> "proc { (2 + 3) }"

(every caveat that phil gave is true. this is a serialized BLOCK, not  
a serialized CLOSURE).




More information about the Ruby mailing list