how stringize/serialize flush code?


i wish means lambda/proc flush code, serialize i disk, following govern lambda later. arrange like...



x = 40
f = lambda { |y| x + y }
save_for_later(f)


later, removed run flush interpreter, i wish means say...



f = load_from_before
z = f.call(2)
z.should == 42


marshal.dump does work procs. i know perl , lisp trivial. nonetheless there proceed ruby? words, doing save_for_later?



edit: nice, nonetheless does tie over giveaway variables (like x) serialize along lambda. instance ...



x = 40
s = save_for_later { |y| x + y }
# => "lambda { |y|\n (x + y)\n}"


... twine cost does consolidate construction x. there fortitude takes account, maybe serializing representation table? opening ruby?



edit 2: i updated answer incorporate serializing internal variables. seems acceptable.



Comments

Popular posts from this blog

list macos calm editors formula editors

how i practical urls indicate .aspx pages asp.net deployed an iis? (preferably but iis)

jaxb - xjc - reworking generated typesafe enum category members