for own(...) loop (spin-off from Re: for..in, hasOwnProperty(), and inheritance)

Axel Rauschmayer axel at rauschma.de
Tue Nov 8 13:19:00 PST 2011


I see two domains for the concept of “own” properties:
1. Meta-programming.
2. Using objects as dictionaries.

Isn’t #2 the majority (at least as far as non-library-programmers are concerned)? Will the concept become less relevant once we have David Herman’s dicts?

I also like the Python-style iterator-based approach, e.g. something like the following:

     for ([key,value] on pairs(obj)) {
     }

On Nov 8, 2011, at 21:49 , Brendan Eich wrote:

> Should ES.next provide sugar for the recommended pattern? To make it compose with declarations and destructuring in the for head, it should use a contextual keyword immediately after 'for':
> 
>   for own (i in o) {
>     body
>   }
> 
> This is a small thing but it might pay off in the long run.

-- 
Dr. Axel Rauschmayer
axel at rauschma.de

home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20111108/53cad1c4/attachment-0001.html>


More information about the es-discuss mailing list