News for hackers. Stuff that matters.
Re:An Object is not a Hash by mcot2 on Monday October 08, 2012 @11:06PM (#4629735)
It sounds like this will all be fixed when js gets proper map types in ES6.
Re:An Object is not a Hash by just2n on Monday October 08, 2012 @11:39PM (#4629836)
When I first saw this post, it didn't include the following snippet:

    Object.create(null);
I disagreed adamantly that a hash with pre-defined names is not a hash. The language already provides a means to get a hash without the pre-defined names, and any clever person can hack around naming collisions regardless. He now notes these things at the end of the article, but then the entire argument doesn't imply that a hash is not a hash. He does a good job pointing out a mistake ALMOST EVERYONE makes, and I applaud that, but the title is horribly misleading, even when given the proper context.

Also, @mcot2, I didn't intend to post as a reply to you, but since I have, to answer your question, collections (Maps, Sets, and WeakMaps) are available in V8 and consequently Node already (via --harmony flags). Because the implementations of these with get/set is not tied to the object's properties, these don't have the same problem.

Re:An Object is not a Hash by comex on Monday October 08, 2012 @11:48PM (#4629862)
Isn't the whole point of Maps that their get/set methods are completely independent from object properties?
Re:An Object is not a Hash by comex on Tuesday October 09, 2012 @02:29AM (#4630279)
(for the record: parent edited his post to address this.)
Re:An Object is not a Hash by just2n on Tuesday October 09, 2012 @02:11PM (#4633095)
I'm sorry about that. I went back later to edit in a comment to make it clear that I had incorporated your point into my response but the edit had expired.
Re:An Object is not a Hash by just2n on Tuesday October 09, 2012 @12:05AM (#4629898)
You, sir, are correct.
Re:An Object is not a Hash by Xcelerate on Tuesday October 09, 2012 @12:20AM (#4629939)
It's unfortunate these new map types are so verbose:

object.set(key, value)

vs

object.key = value