Speaking of Lisp...

Brendan Eich brendan at mozilla.org
Fri Jan 5 19:15:18 PST 2007


On Jan 5, 2007, at 6:59 PM, Chris Double wrote:

> Although 'hasOwnProperty' can be used to avoid this it doesn't work in
> all cases. For example, in Firefox all objects return true for
> hasOwnProperty('__proto__').

Indeed, __proto__ appears to be a property of every object in  
SpiderMonkey.  It's "DontEnum" in ECMA terms, so it does not pollute  
for-in loops, but it's still a hazard reduced in risk only by the __  
bracketing.

> So using an object as a Dictionary has to
> handle issues like this.

Suppose ES4 adds a Hash or Dict class.  Would there be demand for  
initialiser syntax, because a common use-case is a constant or pre- 
filled (whether mutated later or not) mapping?

Any thoughts on value vs. string key?  Surveying real pages, even if  
skimmed by a search such as 'javascript associative arrays', is a  
good idea.  More detail?

/be




More information about the Es4-discuss mailing list