From: ara.t.howard@... Date: 2005-12-08T12:40:23+09:00 Subject: Re: code execution from file? On Thu, 8 Dec 2005, ako... wrote: > thank you very much for your help. > > my application runs inside a web browser process, and creating a thread does > not seem scalable. but what if the user code creates one? it's the only way to isolate $SAFE and your vars, see below... > i tried to evaluate a file from inside a lambda and it seems to work. i also > was able to set safety level for lambda locally which effectively restores > $SAFE when lambda finishes. the only drawback of this was that my > environment is still visible from lambdas. also note that lambda will prevent __everything__ in it's scope from __ever__ being garbage collected. this is bad idea in a web app - assuming it's persistant like fastcgi. in any case be careful: harp:~ > cat a.rb code = IO::read "b.rb" p = eval < cat b.rb exit! harp:~ > ruby a.rb a thread will prevent you main program from exiting. regards. -a -- =============================================================================== | ara [dot] t [dot] howard [at] noaa [dot] gov | all happiness comes from the desire for others to be happy. all misery | comes from the desire for oneself to be happy. | -- bodhicaryavatara ===============================================================================