IOW expose the first-class "reference type" of ECMA-262 via a standard library? Just say no! :)
First, the module function API is written up wrong on the wiki; the function won't take any arguments at all. My apologies, I discovered my mistake as I was working on the spec writeup in the last few days. I'll be updating the wiki as soon as I complete the draft spec. Here's how cycles work. An AMD compatibility layer would simply use the dependency list to look them all up in the loader to pass as arguments to the AMD module-function. Any dependencies that are not there yet are assumed to be forward references in a cycle, and the compatibility layer synthesizes new exports plain-old-objects to pass in to the AMD functions. (BTW we'll be building proof-of-concept AMD compatibility layers to demonstrate that this works.) BTW, this whole module-function rigamarole only exists for AMD compatibility, so it's only important for it to demonstrate interoperability. For normal ES6 use cases there's just no need to use it. Dave On Nov 3, 2013, at 10:03 AM, James Burke <[email protected]> wrote: > With the import/export mutable slots concept, does it make sense to > allow an API that has expresses that type of concept? I think it would > allow creating a module-function thunk that would allow robust cycles > as mentioned here: > > https://mail.mozilla.org/pipermail/es-discuss/2013-November/034576.html > > So something that returns a value, but when it is looked up by the > engine, it really is just an indirection to some other value that can > be set later. Call it IndirectValue for purposes of illustration, but > the name is not that important for this message: > > var value = new IndirectValue(); > > // something is a kind of "ref to a ref" engine type under the covers > var something = value.ref(); > > typeof something === 'undefined' // true at this point > > // Some time later, the code that created the > // IndirectValue sets the final value for it. > value.set([100, 200]); > > // Then later, > Array.isArray(something) // true now > > IndirectValue.prototype.set() could only be called once, and the > engine under the covers could optimize the indirections after the > set() is called so that the indirection would not longer be needed. > > James > _______________________________________________ > es-discuss mailing list > [email protected] > https://mail.mozilla.org/listinfo/es-discuss _______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

