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

Axel Rauschmayer axel at rauschma.de
Tue Nov 8 15:24:04 PST 2011


>> I see two domains for the concept of “own” properties:
>> 1. Meta-programming.
>> 2. Using objects as dictionaries.
> 
> Thanks, good to focus on use-cases. Both would like shorthand and freedom from Object.prototype.hasOwnProperty tamper-proofing.
> 
>> 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?
> 
> We don't know how dicts will fare. Making progress with for own does not interact badly with dicts if we spec them to be for-in'able -- for own (k in d) for d a dict should work, just as for objects.

Ah, shame. I had hoped that a good dictionary implementation would largely make the notion of own properties obsolete (except for #1 use cases). Bringing inheritance into the collection mix seems problematic. That’s why I like Allen’s “data-only-[]” proposal.

I agree with “not interact badly” if there are indeed other use cases.

-- 
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/20111109/b7a264f1/attachment-0001.html>


More information about the es-discuss mailing list