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

Axel Rauschmayer axel at rauschma.de
Tue Nov 8 14:22:44 PST 2011


>> I see two domains for the concept of “own” properties:
>> 1. Meta-programming.
> Could you expand on the use of `own' properties for meta-programming? I'm afraid I can't really envision it =/

Whenever you copy properties from one object to another one, you are usually doing meta-programming (unless you use an object as a dictionary).

>> 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 would think most of the cases where objects are used as dicts would be solved by using `Object.create(null)', today on ES5-compliant engines. Except for the nasty, nasty `__proto__' on engines that use that magic, but then you can proxy property access/assignment. It's quite ad-hoc, but works.
> 
> The dicts proposal looks nice though.


Modulo what Allen is proposing for [] to keep program domain and data domain separate. Then dicts can actually get a size() method.

-- 
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/7f254984/attachment.html>


More information about the es-discuss mailing list