2 ms·
Because the primitive is called Hash my %hash = (); Hash.new So naturally people talk of Hashes etc. I understand where you're coming from, but it's r
by grey-area 14y ago
Because the primitive is called Hash
my %hash = ();
Hash.new
So naturally people talk of Hashes etc. I understand where you're coming from, but it's really not very important, and it would be more confusing to talk of Hash Tables as learners would naturally look for HashTable in the stdlib.
- oleganza 14y agoThat was the question: why the class is named Hash instead of HashMap or Dictionary? Was it done intentionally, or it is just an accident because someone did not know English very well?
- grey-area 14y agoI agree Map or Dictionary would have been fine too, but it's so widely used it needs to be easy to type so two words is not great (HashMap). However I suspect it was just named that way following perl (written by an english speaker). Obviously it's far to late to change it now and I can't say it bothers me or most Ruby users. It's something you get used to very quickly.
- dkersten 14y agoSo do what python did: dict Though even HashMap isn't bad because typing is a solved problem - with auto completion and touch typing two words really aren't an issue in my mind. People get used to living with all kinds of things, but that doesn't make them any better. Yes I'm aware that this applies equally to my typing comment as to you having got used to hash.
- Terretta 14y ago> why the class is named Hash instead of HashMap Why in golang is a function denoted by func instead of function? I'd guess it's because programmers prefer fewer keystrokes as long as the term remains sufficiently mnemonic.
- jlgreco 14y agoThe name 'func' doesn't collide with anything else though. It is an entirely more reasonable abbreviation.