News for hackers. Stuff that matters.
Re:Javascript is good enough by boucher on Sunday February 01, 2009 @03:57AM (#460715)
Any time you ever need to map an object to another object, you need this functionality.

Without a memory address, object's don't have any other unique values associated with them. It's actually a pretty fundamental problem.

Of course, like most things wrong with javascript, you can fix it if you work for it. Objective-J fixes all the things we had problems with, and this is one of them. A lot of things in Cappuccino would not be possible without the hashing feature Tom mentioned.

As a hash table, JavaScript objects are pretty awful. You can't get a count of objects unless you literally count all the keys. And you can't iterate over the keys if anyone else has added anything to the Object prototype.

Cappuccino has a proper hash table, CPDictionary, which solves both of those problems. There's a lot of other data structures that address some of the author's listed concerns.

There are no comments on this comment yet.