On Monday 20 January 2003 07:31 pm, Tim Bates wrote: well, i've been thinking about this for a bit and there seems to be a couple of difficulties involved. lets say to make it as transparent as possible we want to PStore the entire ObjectSpace. one way to do this of course is to loop through the ObjectSpace and add each object to the PStore pool, using something akin to dim's little Database class. the problem is then restoring these objects so everything is just as it was. i don't see how this restoration is possible. to simplify, it occured to me that one might only need to persist the TopLevel which has everything else existing under it. does that follow? you could either persist the toplevel object itself or just the toplevel binding. we can get the toplevel object like this: module Kernel def toplevel eval("self", TOPLEVEL_BINDING) end end but then again, how do you restore the toplevel object? is that possible? alternately if we simply PStored the toplevel binding, we could conceivably return to that context, but to do so we'd have to embed out entire app within an eval statement. (note: fetch_file returns a string of a file's contents) ourprogram.rb # do stuff # all done, now store ps = PStore.new('somefile') ps.transaction do ps['lue'] = TOPLEVEL_BINDING ps.commit end runner.rb # use this to run ourprogram ps = PStore.new('somefile') ps.transaction do if ps['lue'] eval fetch_file('ourprogam.rb'), ps['lue'] else eval fetch_file('ourprogam.rb') end end but this is a questionable approach and rather confusing. besides, running our entire app via an eval would probably be dog slow if it would even work at all. -- tom sawyer, aka transami transami / transami.net .''. .''. . *''* :_\/_: . :_\/_: _\(/_ .:.*_\/_* : /\ : .'.:.'. .''.: /\ : ./)\ ':'* /\ * : '..'. -=:o:=- :_\/_:'.:::. | ' *''* * '.\'/.' _\(/_'.':'.' : /\ : ::::: = *_\/_* -= o =- /)\ ' * '..' ':::' === * /\ * .'/.\'. '._____ * | *..* : |. |' .---"| * | _ .--'| || | _| | * | .-'| __ | | | || | .-----. | |' | || | | | | | || | ___' ' /"\ | '-."". '-' '-.' '` |_. ------------------------------------------------------------