Module isolation

Mark S. Miller erights at
Mon Jan 18 04:38:10 PST 2010

On Sun, Jan 17, 2010 at 11:00 PM, Brendan Eich <brendan at> wrote:

> 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).
Obviously, I will have many positive things to say about the Valija approach
for accommodating legacy. In fact, it was invented in order to cope with the
"highly popular Prototype library" you mention below. However, the picture
is not as rosy as "a burden [only] on implementors". The semantics of
computing between Valija contexts are complicated, in similar but different
manner to how the semantics of JS across frames is complicated today. If
there's interest, I can present Valija with slides 10-15 of <>.

> * 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.
I don't quite understand this. Prototype does not currently work with
modules, so some rewrite is necessary in any case. As long as we're talking
about future Prototype, my impression is that they wanted to migrate away
from mutating primordials eventually anyway.

> /be
> _______________________________________________
> es-discuss mailing list
> es-discuss at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list