Subj : [Q] How to correctly implement 'resolve' for a class.. To : netscape.public.mozilla.jseng From : "t o b e" Date : Wed Oct 08 2003 04:27 pm I'm looking at using the resolve fn in a class def. to implement 'lazy' properties in a JS scriptable C++ app I'm writing. Basically.. I have a set of properties (which are themselves objects) many of which may not be needed by a script and most of which are expensive to create so rather than instantiating them all when I create the global object I'm creating a blank global and using resolve to instantiate them (with DefineObject) in the global when they're actually accessed. The pseudo-code for my resolve is thus: fn resolve(cx, parent, id): if id is an object I know about: DefineObject(etc) return JS_TRUE return JS_FALSE This form causes problems when InitStandardClasses is called on the global object. My resolve fn gets asked to resolve properties with ids such as 'Function', 'Object' which I don't know about so I return FALSE at which point the init bails and everything comes tumbling down (my own init code bails if InitStandardClasses bails, logically enough I thought). If I blindly return TRUE for everything I'm asked to resolve, whether I actually define a property or not, InitStandardClasses succeeds and I can carry on just fine. So. what are these properties 'Function', 'Object' etc I'm being asked to resolve supposed to represent, what should I return for them and what's the right way to do all this ?? Thanks in anticipation... t o b e .