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

Re: Creating entangled objects

From: Jason Orendorff <jason.orendorff@gmail.com>
Date: Tue, 10 Mar 2015 16:12:33 -0500
Message-ID: <CAPh8+ZowRCUbbKyy6f=GsDHML7S7QnHJuUX_WByqRyT8E+oZaA@mail.gmail.com>
To: Jonas Sicking <jonas@sicking.cc>
Cc: "Mark S. Miller" <erights@google.com>, "Tab Atkins Jr." <jackalmage@gmail.com>, David Dorwin <ddorwin@google.com>, public-script-coord <public-script-coord@w3.org>, Boris Zbarsky <bzbarsky@mit.edu>
On Mon, Mar 9, 2015 at 6:57 PM, Jonas Sicking <jonas@sicking.cc> wrote:
> But how does the call that create the two objects create them? If not
> through their constructor?

Prose algorithms.

Here's how the precedents, `new Promise(executor)` and
`Proxy.revocable(target, handler)`, are specified in ES6:

*   https://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-executor
    (particularly note how CreateResolvingFunctions, called in step 9,
    explicitly creates objects and POKEs references to each other into them)

*   Proxy.revocable is clearer:
    https://people.mozilla.org/~jorendorff/es6-draft.html#sec-proxy.revocable
    See step 4.

So the spec has a way to say "ok, create a bunch of objects and hook
'em up like so", but scripts don't. A bit of "putting magic into the
API" seems unavoidable to me, as this is exactly the property you're
after, right?

-j
Received on Tuesday, 10 March 2015 21:13:01 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 10 March 2015 21:13:02 UTC