never got the problem since ES5 ...
function C() {
this.otherEnumerableProp = 123;
Object.defineProperty(this, "notEnumerable", {value: 456});
}
Object.defineProperties(C.prototype, {
method: {value: function method() {
// your cool stuff here, not enumerable
// writable and configurable through the instance
// unless addressed during initialization
}},
property: {enumerable: 1, value: null}
});
But I would expect non-enumerable in ES6 class definition by default, as it
is already for defineProperty/ies and native constructors.
One thing does not scale well in current prototype logic, what has been
flagged in the proto is not inherited with same descriptor per each
instance ( arguable if expected or not )
my 2 cents
On Tue, Mar 27, 2012 at 7:38 AM, Brendan Eich <[email protected]> wrote:
> It's your point about no data properties in the vtable, or the flip side
> of it. The for-in loop was meant to enumerate built-ins' expando and (in a
> few cases, ES3 made this more random) data-but-not-function-valued
> properties, not methods.
>
> It is indeed a just-so story, but the idea is that built-ins have
> intersting data properties (predefined and possibly user-defined) but the
> methods are not "interesting" to for-in users.
>
> /be
>
>
> John J Barton wrote:
>
>>
>> I appreciate understanding why this choice.
>>
>> (FWIW, I totally don't get why non-enumerable even exists).
>>
> ______________________________**_________________
> es-discuss mailing list
> [email protected]
> https://mail.mozilla.org/**listinfo/es-discuss<https://mail.mozilla.org/listinfo/es-discuss>
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss