Module isolation

Brendan Eich brendan at mozilla.com
Sun Jan 17 23:00:02 PST 2010


On Jan 11, 2010, at 7:49 PM, David-Sarah Hopwood wrote:

> If objects cannot be passed directly between modules without breaking
> encapsulation, then it's not a particularly useful module system.
> Passing only JSON objects, say, is not sufficient: it's necessary to  
> be
> able to pass function objects, at least.

Catching up, trying not to rehash or reopen wounds...

I agree JSON is not enough, but frozen primordials could inhibit  
adoption of modules.


>> Isolation does not require frozen primordials, no
>> matter how often you assume it does to conclude that it does.
>
> What part of "I was incorrect in saying that mutable primordials
> *necessarily* preclude isolation." did you not understand?

Sorry, I didn't mean to ignore what you wrote, but it was still not  
enough. You adverted to the "virtualize mutations" alternative, but  
then dismissed it as too complicated:

"It would be possible to virtualize mutations to a module's  
primordials so that they are only visible to that module, in the same  
way that Valija does. I don't favour that approach because it is very  
much more complicated."

A couple of responses:

* Complicated for whom? The complexity of virtualized mutations is a  
burden on implementors, who are few and expert. It relieves the more  
numerous JS hackers from having to revise existing code (sometimes  
there's no money to do so).

* The highly popular Prototype library, and a lot of extant code,  
modifying primordials. If all such code must be rewritten to work in/ 
with modules, then modules have a steep adoption hill to climb.

/be


More information about the es-discuss mailing list