Module isolation

Brendan Eich brendan at
Mon Jan 18 12:43:34 PST 2010

On Jan 18, 2010, at 12:27 PM, Mark S. Miller wrote:

>> Since I do not yet understand what you are trying to say, I may be  
>> the wrong person to guess why I'm finding it hard to understand ;).  
>> Altogether, my best guess right now is that what you are calling a  
>> module is what I would call a sandbox.
> Could be. Is there a hard difference? It's not obvious.
> Users definitely want isolated frame-like "modules". Some browsers  
> even support such things, with postMessage for safe inter-"module"  
> communication. It's a bit heavyweight, but to get back to the topic  
> of this sub-thread: is the only alternative frozen primordials? I  
> think not.
> I never said they were. Whether Valija specifically is the right  
> model for separating primordial mutation, we can of course argue  
> about. But first, I'm still trying to understand your meaning. Would  
> you agree that the Valija sandbox is an example of the concept you  
> are calling "module" above? If so, then fine. Obviously, given the  
> investment we've made in Valija, I am not opposed to that model. If  
> not, then I still do not understand your meaning.

I don't believe I've been unclear. I also don't believe I have to read  
up on Valija to communicate with you. Let's meet in the middle.

JS has mutable primordials. Adding modules won't banish this feature,  
even if you think mutating primordials should be avoided (ES5 makes it  
possible to mutate without breaking things like for-in).

If you insist on frozen primordials for modules to be used, then we'll  
have to define and agree on sandboxes. But whatever you call them, if  
you miss the mark with frozen-primordial modules, users will not use  
them and we'll have wasted our time.

Another possibility, with precedent in other languages, is two levels:  
the outer module system, acyclic and generally bigger by unit; and the  
inner one, with first-class modules. There is not good agreement on  
the name for the outer thing. If you want we can say sandbox.

One could imagine cooperating modules sharing mutable primordials  
within a sandbox, and of course not sharing primordials across the  
sandbox boundary.

Again the point is that frozen primordials should not be dictated.

Sorry if this is annoyingly recapitulating Valija. The list is read by  
many people, not all conversant, and in order to avoid assuming too  
much, I believe we should try to work from broader precedent and first  
principles. I'll look at Valija later today.


More information about the es-discuss mailing list