Subj : Re: Spidermonkey problem To : netscape.public.mozilla.jseng From : Jan Herling Date : Sun Jul 10 2005 01:11 am Thank you Pete, I understand what you mean. Perhaps you could help me once more! Is there a possibility to get an assign operator for an object itself? Currently I'm doing this with a small hack: After create the object I set this object as a property of the parent object. Therefore I'm using the JS_DefinePropertyWithTinyId function and set the getter and setter values. But this only works with objects which I create before executing a script. Because I have to know the name of the object (therefore my last question) for the JS_DefinePropertyWithTinyId function. Do you know a different way to implement this assign operator? Greetings Jan Peter Wilson schrieb: > Objects don't have names - so no that's not possible. > > The name is simply a 'reference' to that object so you can make use of > it. There can be multiple references to the same object: > var a,b,c > a = b = c = new Color > > What's the 'name' of the new Color object? > > If you are used to languages like 'C' then think of the names as > pointers to the underlying object. > > Hope that helps > Pete > -- > Peter Wilson > http://www.yellowhawk.co.uk --- http://www.whitebeam.org > --------------- > > Jan Herling wrote: > >> Hallo, >> >> I would like to knonw if there is a possibility to get the name of a >> JS Object. >> >> >> Details: >> >> I'm using Spidermonkey in my c++ project. >> I defined my own class for JavaScript with name "Color". >> This class has three properties "r", "g", "b". >> >> So for example I have the following script: >> >> function foo() >> { >> var value = new Color(); >> } >> >> After executing the script the constructor of the Color-Class is called: >> (in my c++ code) >> >> JSBool TColor::JSConstructor(JSContext *cx, JSObject *obj, uintN argc, >> jsval *argv, jsval *rval) >> { >> >> >> } >> >> Now I would like to get the name of the obj in the Script (In my >> example the name would be "value". >> >> Is this possible? >> Perhaps a function: char* JS_GetName(obj); >> >> Greetings >> >> Jan >> .