classes and enumerability

Boris Zbarsky bzbarsky at mit.edu
Tue Dec 23 17:05:35 PST 2014


On 12/23/14 4:35 PM, Andrea Giammarchi wrote:
> Or better ... why would anyone expect or want them to be enumerable?

This is a good question.  Note that there is web content that depends on 
the current setup wherein stuff on DOM prototypes is enumerable... you 
may want to check on why exactly they do that.

I agree that it would have been better all around if none of this stuff 
had been enumerable historically.  As things stand, ES builtins are 
non-enumerable, DOM builtins are enumerable, and someone designing an 
API and wanting to be "consistent with the platform" is screwed.

The situation is especially bad for things that start off in the DOM and 
then move into ES; for example right now Gecko and Blink are not 
interoperable on whether "then" is an enumerable property of 
Promise.prototype...

> You also know ES6 is the only window we have 'cause after that it will
> be a breaking change.

Pretty much anything here is a breaking change, sadly, no matter what we 
pick.  Certainly your proposed change is a breaking one if the intent is 
that Web IDL outputs ES classes...

-Boris



More information about the es-discuss mailing list