3 ms·
> "!" for modifying functions in place I think that consistently using "!" to mean "mutates in-place" would be a good convention for a language to use, but tha
by bakery2k 9y ago
> "!" for modifying functions in place
I think that consistently using "!" to mean "mutates in-place" would be a good convention for a language to use, but that's not what Ruby does. From Matz himself [1]:
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.
[1] https://www.ruby-forum.com/topic/176830#773946 https://www.ruby-forum.com/topic/176830#773946