There was some heated debate on twitter too just yesterday: https://twitter.com/domenic/status/547146484479561730 <https://twitter.com/domenic/status/547146484479561730>
Just wondering, is es6 class frozen? In those tweets Brendan proposed "enum in obj lit, not in class”. Looks like class is still open for modification? > On Dec 24, 2014, at 9:17 AM, Rick Waldron <waldron.r...@gmail.com> wrote: > > > > On Tue Dec 23 2014 at 7:35:44 PM Andrea Giammarchi > <andrea.giammar...@gmail.com <mailto:andrea.giammar...@gmail.com>> wrote: > Dear Santa, > I wish since ES3 era that properties defined on a prototype are by default > **not** enumerable. > > By any chance we can make this happen in ES6 classes? > > ES6 is done, properties of user created prototypes are enumerable by default. > They can be made non-enumerable if you want them that way, but doing so by > default is inconsistent with constructor function + prototype definition. > > > Or better ... why would anyone expect or want them to be enumerable? > > - Consistency with constructor function + prototype definition (severe > refactoring hazard). > - Pretty useful for dynamically creating collection APIs, eg: > > Object.keys(Servo.prototype).forEach(function(method) { > // Create `Servos` collection class wrappers for each method > Servos.prototype[method] = function() { > var args = [].slice.call(arguments); > this.each(function(servo) { > Servo.prototype[method].apply(servo, args); > }); > return this; > }; > }); > > > > To define a `class` is a very explicit intent, I believe having those > definitions non enumerable would be a preferred option for majority of > developers that have been doomed in `for/in` since kinda ever before > enumerable was not configurable. > > All default methods and properties in native prototypes are **not** > enumerable, why does it have to be so inconsistent with userland? > > The widely understood, wholly well-known semantics: > > - Properties of built-in prototype objects are non-enumerable > - Properties of user defined prototype objects are enumerable by default, but > can be made non-enumerable if desired. > > > > You also know ES6 is the only window we have 'cause after that it will be a > breaking change. > > No: any future annotation syntax must allow for defining writable, > configurable and enumerable attributes. > > > > Thank you at least for any sort of extra/concrete clarification about this > choice. > > - > https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-09/sept-18.md#concise-method-definition-revisited > > <https://github.com/rwaldron/tc39-notes/blob/master/es6/2012-09/sept-18.md#concise-method-definition-revisited> > - > https://github.com/rwaldron/tc39-notes/blob/c61f48cea5f2339a1ec65ca89827c8cff170779b/es6/2014-01/jan-28.md#concise-methods-and-enumerability > > <https://github.com/rwaldron/tc39-notes/blob/c61f48cea5f2339a1ec65ca89827c8cff170779b/es6/2014-01/jan-28.md#concise-methods-and-enumerability> > - https://esdiscuss.org/topic/enumerability#content-23 > <https://esdiscuss.org/topic/enumerability#content-23> > > > The consistency argument has won every time this conversation is brought up. > There are ways to get what you want in the future (probably even in ES7), but > changing the default is not the solution. > > Rick > _______________________________________________ > es-discuss mailing list > es-discuss@mozilla.org > https://mail.mozilla.org/listinfo/es-discuss
_______________________________________________ es-discuss mailing list es-discuss@mozilla.org https://mail.mozilla.org/listinfo/es-discuss