es-discuss Digest, Vol 35, Issue 25

Wes Garland wes at
Mon Jan 18 13:08:46 PST 2010

> 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.

Array.prototype.a = "hello"; = [];

Array.prototype.a = "world"; = [];

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);

hello world
true true


Wesley W. Garland
Director, Product Development
PageMail, Inc.
+1 613 542 2787 x 102
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the es-discuss mailing list