Re: Associating new objects with globals: how to best do it?

On Feb 25, 2014, at 10:48 AM, Allen Wirfs-Brock wrote:

> 
> On Feb 25, 2014, at 9:45 AM, Boris Zbarsky wrote:
> 
>> 
>> We've talked about some sort of default global-association for WebIDL methods and geteters.  Would it make sense to align this with the ES6 behavior by declaring that if a WebIDL method creates objects it does so in the global of the callee function unless something explicitly specifies otherwise?
> 
> ES6 requires that every function, including get/set functions have a Realm association. 
> 
> Just to be clear, when you say "callee" above you mean the WebIDL method under discussion.  If so, then what you are describing is consistent with the ES6 requirements.  A function that creates a new object normally initializes the new object (eg, sets its [[Prototype]]) using the Realm of the creating function.

A follow on thought.  You should probably specify that all WebIDL functions (including methods, constructors, get/set functions, etc.) are "Built-in function objects" as defined in 
http://people.mozilla.org/~jorendorff/es6-draft.html#sec-built-in-function-objects Or perhaps, a refinement of that.

This takes care of the Realm association and allows the function to be implemented either 'natively" or via ECMAScript code, at the choice of the implementation.

Allen

Received on Tuesday, 25 February 2014 19:02:16 UTC