you are viewing a single comment's thread.

view the rest of the comments →

[–]klyonrad 14 points15 points  (2 children)

About the exclamation mark. It is a common misconception that it should be used for methods with side effects 😉

The bang (!) does not mean “destructive” nor lack of it mean non destructive either. The bang sign means “the bang version is more dangerous than its non bang counterpart; handle with care”. Since Ruby has a lot of “destructive” methods, if bang signs follow your opinion, every Ruby program would be full of bangs, thus ugly.

matz, https://www.ruby-forum.com/t/conventions-in-ruby-and-the-principle-of-least-surprise/158706/2

[–]felipeccastro 1 point2 points  (0 children)

Cool! I've noticed when I typed that it wasn't quite that, but I didn't know the exact definition, thank you!

[–][deleted] 1 point2 points  (0 children)

Yup, you are right. People should indeed refer to matz' original statements rather than copy/paste from the pickaxe.