Addition of a global namespace function?

Patrick Mueller pmuellr at yahoo.com
Thu Dec 3 12:22:11 PST 2009


On Dec 3, 2009, at 3:01 PM, Alex Russell wrote:

> Personally, I don't think this is sufficient to solve the largest set of problems that users encounter with the language. Specifically, if entering a namespace does not prevent global pollution (i.e., omitting "var" still pollutes), then it seems to me like the proposal is something of a missed opportunity.

I agree.  Are there any proposals to add the capability of creating new top-level "scopes" (contexts?) and running a script in them, such that something like CommonJS modules could be implemented in user-land code?  I imagine it as something like HTML5's importScripts() function (available to Workers only), but it would run the script (a single script) in a newly created top-level scope, and return that scope as an object from the function itself.

Patrick Mueller - http://muellerware.org/




More information about the es-discuss mailing list