Enumerability

Andrea Giammarchi andrea.giammarchi at gmail.com
Sat Jan 11 09:57:06 PST 2014


Thanks Allen, makes sense ... but still no example where enumerability of
properties and method defined in a "class" prototype is useful for ...
something I cannot imagine right now.

Anything?

I understand for-of replaces ... etc etc ... for-of is not easy to polyfill
though while class sugar is straight forward.


On Sat, Jan 11, 2014 at 9:39 AM, Allen Wirfs-Brock <allen at wirfs-brock.com>wrote:

>
> On Jan 11, 2014, at 9:24 AM, Andrea Giammarchi wrote:
>
> > I would like to see some Rick or David example about the "expected to be
> enumerable".
> >
> > If that's about knowing if a class is native or not, looping with a
> for/in its prototype or any instance does not seem to mean anything
> reliable since even native methods can be redefined and made enumerable.
>
> It's not just prototypes.  The same non-enumerability conventions are
> applied to built-in constructor properties (ie, class static methods).
>
> >
> > If that's the case I would rather consider a simple
> `Object.isNative(generic)` proposal that would simply return true for all
> native things that would return `[native code]` via
> {}.toString.call(generic)
>
> This has nothing to do with "native code".  Built-ins can be self hosted
> using JS code and show that code (or not) in their toString.  It's strictly
> a specification issue.  The spec. says that, in general, built-in methods
> are non-enumerable and that non=built-in methods are enumerable.
>
>
> allen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20140111/668b453d/attachment.html>


More information about the es-discuss mailing list