Ruby Hash's update method
Today I learned that update
is a synonym for merge!
for a hash.
a = {x: 1}
a.update({y: 2})
a == {x: 1, y: 2}
I say update
is a synonym for merge!
but really the C method that they share is called rb_hash_update
. So who is the synonym of who? I think the etymology of all the various alias methods in ruby core would be a fun subject. Was map
or collect
introduced first, etc, etc.