Subj : 'Replacing' loaded functions and host objects in a shared scope To : netscape.public.mozilla.jseng From : cyberlync@yahoo.com (Eric Merritt) Date : Thu Aug 21 2003 05:44 pm Hello all, I am trying to embed rhino in a servlet application. So far everything works well, but I think that there is a more efficient way to do things then the way I currently am doing them. Right now I have three types of things that get put into two scopes, a lib scope and a script scope. The lib scope holds library type functions and host objects, the script scope holds individual functins that may be called. The lib scope serves as a prototype to the script scope. Lib scripts, Script scripts and host objects may be changed on the fly and need to be reloaded. For the script scope things are easy, if the script changes on disk I just create a new scope, set the lib scope as its prototype and evaluate the script (I actually call the script functions later). The lib scope is where I am worried. Currently if a host object or script changes I discard the parent scope reload all of the lib scripts and host objects to get them into the new scope, then I reload all of the scripts in the script scope. This is ok now becuase there are not to may of the lib scripts or host objects. However, that will change. Remembering that this is a multi-threaded environment what are the implications of simply re-evaluating the lib scripts in the original lib scope and if a host object changes simply re-inserting the host object with the same name in the lib scope. I worry that this is going to have syncronazation issues becuase scripts in the script scope rely on the lib scope. Will this work for the lib scope? If I can do this with the lib scope can I reuse script scopes in a similar way? I hope I am making sense here. Thanks for the input, Eric .