Sharing objects across modules (was: VirtualHandler fundamental traps default values)
bruant.d at gmail.com
Tue Sep 11 12:22:51 PDT 2012
Le 11/09/2012 21:14, Tom Van Cutsem a écrit :
> Note that in ES6, Reflect should probably be represented as a module
> instance, not as a global object. So then Handler.prototype would
> inherit from a module instance object. I don't see anything
> necessarily wrong with that, but I just want to point it out.
Is there a value to instanciate the Reflect module several times? So
far, it's only made of stateless methods, it would save memory to have
only one Reflect object in my opinion.
If modules aren't the tool to share a single object across other
modules, what is such a tool? Because it seems to be a valid use case.
Likewise for the same of interoperability, if there is an @handler
module, it ought to be a unique function (otherwise, two instances of
two different @handler constructors do not share the same prototype).
More information about the es-discuss