Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion Removing JS_ConstructObject, JS_ConstructObjectWithArgument s
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Dave Mandelin  
View profile  
 More options May 31 2012, 2:01 pm
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:
> 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
> We're still officially using the release before 1.8.5 (1.7) - when the API was
> still stable. We have a 'work in progress' porting to 1.8.5 which is proving
> something of a nightmare. Since then the API seems to be a moving target.

> I've always favoured backwards compatibility as APIs evolve creating the minimum
> barrier to people upgrading. This certainly worked fine for SpiderMonkey for
> many years.

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).

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.

> Isn't the correct approach here to leave JS_ConstructObj in the API for
> compatibility and make it a wrapper for the new mechanism?

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?

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.