>
> Precedent and developer conversations I've had strongly suggest that some
> code wants mutable primordials on the inside of a module that can be
> consumed without the mutations affecting the importer's primordials.
>

It would be *really* interesting to have  module-local prototypes -- and not
only the standard classes, but also for user-defined classes which originate
from other modules.

Imagine, if you will, that modules add an extra layer in the scope chain
which somehow intercepts and proxies prototypes, resolving prototype misses
up to the "real" prototype for said class -- analogous to the way property
misses are resolved in JavaScript.

moduleA.js:
Array.prototype.a = "hello";
exports.foo = [];

moduleB.js:
Array.prototype.a = "world";
exports.foo = [];

program.js:
print(require("moduleA").foo.a, require("moduleB").foo.a));
print(require("moduleA").foo instanceof Array, require("moduleB").foo
instanceof Array));
print(typeof Array.prototype.a);

output:
hello world
true true
undefined

Wes

-- 
Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102
_______________________________________________
es-discuss mailing list
es-discuss@mozilla.org
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to