Comments on Sept Meeting Notes

Brendan Eich brendan at mozilla.com
Fri Sep 27 13:20:39 PDT 2013


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


More information about the es-discuss mailing list