[Ruby] Why is a dictionary called a dictionary

[Ruby] Why is a dictionary called a dictionary in Python and the same thing is called a hash in Ruby ?

They are also called tables in Lua! It’s whatever the designers liked.

You program in Lua ?

You program in Lua ?

No… but I ‘read around’!

Hash because is the most popular implementation of a mapping data structure. It is an implementation detail that emerged to be the name the same way Gillette is used in place of razor blade in many places around the world. It was a cultural phenomena in the age when Ruby was created: people used more the word Hash than Map because they were “So Impressed”.

Dictionary because is the a popular use case of a mapping data structure. Same history.

Although I find the word Dictionary better than Hash because it is independent of the implementation.

Map is a good name… It is the same as Dictionary, but you can say “a dictionary is a map” but you can’t say “a map is a dictionary” all the time. So I think Map is the best name.

Opinions opinions.

1 Like