Subj : spidermonkey: reserved slot vs. private To : netscape.public.mozilla.jseng From : Jens Thiele Date : Fri Sep 17 2004 07:13 pm Are JS_SetPrivate / JS_GetPrivate functionally "equal" to JS_SetReservedSlot / JS_GetReservedSlot ? to use JS_SetPrivate / JS_GetPrivate one has to specify JSCLASS_HAS_PRIVATE in the JSClass structure to use JS_SetReservedSlot / JS_GetReservedSlot one has to specify JSCLASS_HAS_RESERVED_SLOTS(xxx) are reserved slots handled like "normal" properties? (they are jsval's, they are garbage collected?, ...) but hidden => reserved slots could sometimes be an alternative to private data What I want to do: i use SetPrivate/GetPrivate to store some pointer to an native object (always making sure the class is correct) the js object finalizer should only free the native object referenced by the pointer if the js object owns this native object => i must store that ownership information somewhere of course i could wrap the pointer and the ownership information in another struct (or store this information somewhere completely different) but if i could use the reserved slot to store the ownership information this would be much simpler. or do I get the reserved slots completely wrong? .