Comments on Sept Meeting Notes

André Bargull andre.bargull at
Fri Sep 27 13:33:34 PDT 2013

On 9/27/2013 9:58 PM, Kevin Smith wrote:
>     In this case I doubt @iterator or @toStringTag should be visible.
>     (And I know there a better ways to test for empty objects, but
>     for-in testing is common enough...)
> Thanks Andre!  I fear this example merely begs the question of whether
> such an object should be considered "empty" with respect to
> enumerability.  Would anything break if the following object were
> considered "not empty"?
>      var obj = { "@iterator"() { /* ... */ } };
> More generally, what is accomplished by hiding these hooks from for-in?

Whether or not some code breaks depends on how that function is used, so 
it's hard for me to give a general answer at this point. Concerning your 
second question about the benefits of hiding hooks: I'd assume if 
something is a "meta-level" hook, it should only be visible on the 
"meta-level" and not on the concrete data level. And for-in is rather a 
tool to access the concrete data level than to access the meta-level.

PS: The function is called "isEmptyObject" in jQuery ->

- André

> { Kevin }

More information about the es-discuss mailing list