Subj : Re: (Spidermonkey) Converting a property name to a tinyId To : James Turner From : Brendan Eich Date : Mon Mar 17 2003 04:04 pm > > >// this method is static >jsbool MyBaseClass::mySetProperty(JSContext *ctx, JSObject* obj, jsval >prop, jsval *value) >{ > MyBaseClass *ins = (MybaseClass*) JS_GetPrivate(ctx, obj); > > ... do some common bookeeping code to mark 'ins' as dirty, ensure >it's writeable, etc .... > > if (JSVAL_IS_INT(prop)) > ins->setBuiltinProperty(JSVAL_TO_INT(prop), value); > else { > .... simulate the default behaviour of SetProperty .... > What do you mean by default behavior? The default getProperty and setProperty implementations are stubs that return true. Can't you just do if (!JSVAL_IS_INT(prop)) return JS_TRUE; return ins->setBuiltinProperty(JSVAL_TO_INT(prop), value); here? (I'm pretending setBuiltinProperty returns a boolean indicating error/exception with false.) /be .