Subj : Re: request for new feature in spidermonkey (or workaround) To : Brann Joly From : Igor Bukanov Date : Mon May 10 2004 05:52 pm Brann Joly wrote: > Hi, > > In the getter protoype, there is an extra parameter "tinyid" enabling the > getter function to know which member of the object was requested. > > I can't find any way to do the same things with methods (i'd like > spidermonkey to call the c++ function associated with the js method with an > extra parameter containing kind of tinyid identifying the called method. > > The reason why i want to do that is that i want to make available to > javascript some objects i don't know about at compile time (since i cant > create the wrappers at compile time, i would need to create'em at runtime, > but it doesn't seem to be possible in c++) > > The member functions of the c++ objects are called via a message system, so > with the extra parameter i'm asking for, i would be able to determine the > message id to send, according to the tiny id provided by spidermonkey In JS you call the member function foo.bar() in the following ways: foo.bar_alias = foo.bar; foo.bar_alias(); or var x = for.bar; x.call(foo); So you can not rely on the fact that your function would be called through the same member! Why not to use the function name instead? Regards, Igor .