4 ms·
"then nothing can ever go wrong." What about the key "_proto__" (forming "__proto__") [1]? That will screw up your dictionary badly. It's not so easy. Which i
by ootachi 15y ago
"then nothing can ever go wrong."
What about the key "_proto__" (forming "__proto__") [1]? That will screw up your dictionary badly.
It's not so easy. Which is why you want Harmony Maps and Sets in the first place.
[1]: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/proto https://developer.mozilla.org/en/JavaScript/Reference/Global...
- btilly 15y agoGood point. I shouldn't have tossed that off of the top of my head, particularly since I'm not a JavaScript programmer. But the principle is right, you just need a different starting key than "_" to avoid conflict. Something like, "dict_" should work. And hide the details behind accessors. So if that breaks in a future version of JavaScript, it is easy to change it again.