Subj : Creating classes/namespaces on the fly from existing functions? To : netscape.public.mozilla.jseng From : bubbfree Date : Wed Jan 05 2005 10:21 am I have a set of functions stored in an external file, defined by the user. I'd like this to be the basis of some sort of library, but have an automatically generated namespace to avoid conflicts between multiple external files. Is it possible in SpiderMonkey to do something like this: externalFile1.js: function a() { .... } function b(foo, bar) { .... } externalFile2.js: function a() { ..!. } mainFile.js: useLibrary("externalFile1.js"); useLibrary("externalFile2.js"); externalFile1.a(); externalFile1.b(5, 10); externalFile2.a(); (of course, the file name would have to conform with class/variable naming syntax). The object or namespace 'externalFile1' would be dynamically created by the useLibrary() implementation, and all functions found in that file would be added as member functions of the newly created object/namespace. Is this possible? Thanks! .