Class double-bind

Allen Wirfs-Brock allen at wirfs-brock.com
Thu Mar 5 17:00:29 UTC 2015


On Mar 5, 2015, at 8:50 AM, Domenic Denicola wrote:

> From: es-discuss [mailto:es-discuss-bounces at mozilla.org] On Behalf Of Boris Zbarsky
> 
>> Just to be clear, this would make class declarations behave differently from builtins, both the ES kind and the IDL kind, right?
> 
> I think that would be true if your mental model of built-ins is that, in the global scope, someone did `class Array { ... }` or `class Window { ... }`.
> 
> But my mental model has been that, in some other scope (probably a closure to encapsulate private helper functions, or a module) someone does `global.Array = class Array { ... }` and `global.Window = class Window { ... }`. That is, at least, what we do in jsdom.

In addition, global class declaration don't create global object properties.  So the global built-in can't be considered to be as if defined by global class declarations. 

Allen


More information about the es-discuss mailing list