Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Array#map! actually exists in Ruby, too. It mutates the array item by item. Enumerable#each doesn't have a bang, because it doesn't change the enumerable itself, even though it can mutate the objects contained in the enumerable. This is overall consistent -- there's a distinction between mutating the receiving object and mutating objects contained in or referred to by the receiving object.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: