domenic at domenicdenicola.com (2013-10-13T02:43:04.588Z)
Kevin Smith wrote:
> Is there a concrete example which shows how enumerability of
> meta-level properties would present a problem for such code? That
> might be convincing.
All the noise we made about Object.extend was unclear? From jQuery:
https://github.com/jquery/jquery/blob/master/src/core.js#L157
Many similar functions, going back to Prototype's Object.extend:
```js
Object.extend = function(destination, source) {
for (var property in source)
destination[property] = source[property];
return destination;
};
```
Kevin Smith wrote: > > Whether you personally use it, for-in is a reality. Introspection > of objects happens, so if you ship a library that's putting > meta-level properties into objects it needs to make them > non-enumerable to be robust in the face of client code that uses > for-in but isn't prepared to understand the meta properties. > > Is there a concrete example which shows how enumerability of > meta-level properties would present a problem for such code? That > might be convincing. All the noise we made about Object.extend was unclear? From jQuery: https://github.com/jquery/jquery/blob/master/src/core.js#L157 Many similar functions, going back to Prototype's Object.extend: Object.extend = function(destination, source) { for (var property in source) destination[property] = source[property]; return destination; }; /be