Separating a Hash type from Object

Brad Fults bfults at gmail.com
Fri Jul 27 19:29:29 PDT 2007


On 7/25/07, P T Withington <ptw at pobox.com> wrote:
> If this is the poll:
>
>   1. Map (because it maps one thing to another)

This seems reasonable until you consider the conflict between Map and
Array.prototype.map. I think this confusion is enough to knock Map way
down on the list.

>   2. Dictionary (not as good because it makes me think keys must be
> strings)

Agreed with the reasoning and I'd add that its length doesn't help.

>   3. Dict (dorky Unixese for an English word)

Agreed; clunky, difficult to say, rather obscure.

> -∞. Hash (only nerds would have a clue what this means)

Disagree. In computer science these data structures are taught as
"hash tables". Anyone who is even casually acquainted with computer
science will know what hash tables are and thus this seems like an
acceptable shortening. For those without previous computer science
experience, it's a single term to learn among the myriad others in ES4
and has already been successful in other language markets (see Perl,
Ruby).

Hashtable is another option as the more verbose description of the
data structures that we learn in computer science, but it disregards
the JS convention of camel casing multiple words in objects (see
RegExp and virtually all methods in the core language).

HashTable is the obvious solution to the problem of camel casing. This
is a fine option, but I see no reasonable argument to use this over
the shorter, simpler "Hash". Likewise for HashMap.

-- 
Brad Fults



More information about the Es4-discuss mailing list