W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2014

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

From: Allen Wirfs-Brock <allen@wirfs-brock.com>
Date: Tue, 25 Feb 2014 11:01:42 -0800
Cc: public-script-coord@w3.org, Bobby Holley <bholley@mozilla.com>
Message-Id: <76A2ED1D-6C3E-449D-A142-9C5F88E89E1E@wirfs-brock.com>
To: Boris Zbarsky <bzbarsky@MIT.EDU>

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

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:37:51 UTC