I decided to bring out this Hash->Dict topic in a different thread from the thread on Synopsis r14407 about Object->Universal since I consider them separate though tangential matters that should be argued on their individual merits.

In the interest of that Perl data types are better off being named primarily after their meaning rather than their implementation, probably the current worst offender is Hash.

Barring some better name, I highly recommend/propose renaming Hash to Dict.

The term Dict (as a short form of "dictionary") is well understood by general people and is the term used for associative arrays in some other languages, so it is easy to learn, and easy to explain to people in Learning Perl.

The term Dict is easier for new people to Perl, either new programmers or visitors from other languages, to learn than Hash is. It allows more self-documenting code where one is used. And writing Learning Perl should be easier.

For Perl 5 people, it should be very easy to adapt, or for the most part they may not notice any difference save for documentation references.

You also have equal huffmanization since the terms Hash and Dict are both of the same length, and they are also equally easy to type.

And aside from the 4 letter word, all the other details associated with hashes, eg the % sigil and {} constructor, and parts named keys,values,pairs,kv et al can/should remain the same as they are.

In fact, since many users of Perl don't refer to the data type by the name Hash but rather just by % or {}, the change may not take from their useability at all or they may not even notice that a change occurred at all, so easy to adapt.

Of course, if that change is made, KeyHash should be renamed to KeyDict, and so forth.

After this change, the term Hash is then freed up to be used more specifically to describe an implementation detail of something and/or hashing functions et al.

I think this change would be a good thing.

Feedback is appreciated, either pro or con.

-- Darren Duncan

Reply via email to