Let me reply to the one issue that I think may be fundamental -- On Sun, Aug 2, 2009 at 1:36 PM, Mark S. Miller<[email protected]> wrote: > Are later inline scripts invoked after previous <script src="..."> have been > evaluated? If so, then the JSONP trick above isn't necessary. If not, then > this JSONP trick does work but creates a bad namespace management problem. > Where do these names come from and how are they gc'ed?
The intention is to support a module loader that can handle multiple async requests from end-user code. As such, which one of them returns first is nondeterministic. This would have to be set up by the outermost container, in plain uncajoled JS. An example of how this is done is in Ziqing's changelist here: http://codereview.appspot.com/96177/diff/1028/26 Scroll down to "scriptModuleLoaderMaker =" and start reading from there. (Yes, we probably should not put all this into cajita.js, but that's not the issue at the moment.) The upshot is this: A global counter is kept in the "window" object, a new function name gets allocated every time an async request is made, and that function deletes itself when the request is finished. This has a GC problem if a majority of the requests do not return correct results, since <script>s do not return anything if (say) the HTTP 404s or whatever. To the extent that these requests would be primarily going to a cajoling service, this is an (almost) orthogonal issue: how do we return, *in-band* in the return results of the cajoling service, a list of cajoling errors? If we solve this, then the function registered to handle the <script> *would* be called; it would figure out what to do with the error; then it would delete itself. Ihab -- Ihab A.B. Awad, Palo Alto, CA
