For those not familiar with Ruby terminology, "hash" in this context means what other languages would call a hash map, associative array, or dictionary. At first I thought it was referring to the hash of a value, and couldn't grok it.
For those not familiar with Ruby terminology, "hash" in this context means what other languages would call a hash map, associative array, or dictionary. At first I thought it was referring to the hash of a value, and couldn't grok it.
(The Django templating language does this too, albeit in a more magical way: https://docs.djangoproject.com/en/4.1/ref/templates/language...)
Just... make sure you're aware of the issue that the OP's RCE brings up!
Interesting. The only other time I've seen this term used for a hash map is in the context of Redis hashes [0], which confused me to no end when I first encountered them for the same reason. Given that Redis itself is written in C, I wonder where the term originated.
Perl: Hash
Ruby: Hash
PHP: HashMap
Java: HashMap
Haxe: Map
Golang: map
Swift: Dict
Python: Dict
C#: Dictionary
Javascript: Object
Redis: Hash
Postgresql: hstore, json DESCRIPTION
Variable names
Perl has three built-in data types: scalars, arrays of scalars, and
associative arrays of scalars, known as "hashes". A scalar is a single
string (of any size, limited only by the available memory), number, or a
reference to something (which will be discussed in perlref). Normal
arrays are ordered lists of scalars indexed by number, starting with 0.
Hashes are unordered collections of scalar values indexed by their
associated string key.
Hash is ubiquitous.In Programming Perl it says "Associative Arrays" in 1st edition and "Hashes (Associative Arrays)" in 2nd edition.
NB. 2nd edition was the first to cover Perl5
Not sure why they would need a class for that when they already have a primitive type that does the job. I guess maybe a new OO interface will have its parameters ordered more consistently?
Also Java has like ten different implementations of Map<K,V> depending on various use cases.
> Javascript: Object
And in javascript, if you use an Object as a map, the keys do have to be strings (if they aren't already, they are converted into strings).