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.
[ Parent
| on HN ]
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.
Isn't the whole point of Maps that their get/set methods are completely independent from object properties?
(for the record: parent edited his post to address this.)
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.
You, sir, are correct.