Newsgroups: mozilla.dev.tech.js-engine
From: Dave Mandelin <dmande...@mozilla.com>
Date: Thu, 31 May 2012 11:01:38 -0700 (PDT)
Local: Thurs, May 31 2012 2:01 pm
Subject: Re: Removing JS_ConstructObject, JS_ConstructObjectWithArguments
On Thursday, May 31, 2012 10:50:28 AM UTC-7, Peter Wilson wrote:
Of course; backward compatibility is the normal thing to do. I don't see how we can maintain compatibility in the current environment, though. We need to change APIs quite a bit to support things like modern GC, compartments, and new jsvals (in the JM days). > On 22/05/2012 22:41, Jeff Walden wrote: > > On 05/22/2012 12:10 PM, Peter Wilson wrote: > >> And yes - we use JS_ConstructObject to create instances of our native classes. > >> There may be a better way to do this but certainly at the time we first started using SpiderMonkey there was no other way that I could find (other than effectively running a wasteful eval on 'new MyClass') to correctly instantiate an object.
> > This must have been before JS_New, right? JS_New (passing MyClass for the constructor) is the right way to do |new MyClass(...)| in modern JSAPI, of the sort that'll be in whatever SpiderMonkey release contains the current trunk code. Does JS_New not work for your purposes in any way?
> > Jeff
> I've always favoured backwards compatibility as APIs evolve creating the minimum In a way, we have been building a new SpiderMonkey out of old SpiderMonkey parts, and the new one needs a new API. The interim "releases" are snapshots of iterations within that overhaul. Creating a new stable API will be a lot of work and only makes sense to do after the engine itself has stabilized.
> JS_New doesn't exist in 1.7.
What about taking the JS_ConstructObject code Jeff posted and putting it in your project, i.e., moving the function from API to your code?
> Isn't the correct approach here to leave JS_ConstructObj in the API for Dave
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
| ||||||||||||||