Re: Object creation in SpiderMonkey 45

Boris Zbarsky <[email protected]>
Newsgroups gmane.comp.mozilla.devel.jseng
Message-ID <[email protected]>
On 5/5/16 8:56 AM, Mihai Dobrescu wrote:
> but for some reason it doesn't call the custom toString when it is
> created this way. Any hints?

Where does the custom toString live?  In your examples:

var ap1 = new AIRealPoint(3, 3);
var r = new AIReal(3);

is it the case that Object.getPrototypeOf(r) ==
Object.getPrototypeOf(ap1.h)?

Or put another way, when you say "h and v properties are defined using a 
templated function, basically creating a custom object of type AIReal 
(in this case) to return, using JS_NewObject", how _exactly_ are you 
doing this?  What does the JS_NewObject callsite look like?

-Boris
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.