From: "David A. Black" Date: 2007-12-02T16:44:14+09:00 Subject: Re: Why are "Array#push" and "pop" not "push!" and "pop!"? Hi -- On Sun, 2 Dec 2007, John Joyce wrote: > To put it another way, consistency for consistency's sake alone is not the > goal. > Consistency helps make things somehow predictable, but sometimes it's just > bloat. > > That said, if Ruby had immutable classes, it would be important to have > push # return a new Array object with the result of a push > push! # alter the Array object in place with the result of push > pop # return a new Array object with the result of a pop > pop! # alter the Array object in place with the result of pop I think the whole question of what the best names were for those methods would have to be revisited. Since push and pop are, by convention and tradition, object-mutating methods, it would be very weird to suddenly have "non-dangerous" versions of them that didn't change the object, and to define "danger" as behaving the way push and pop are always (as far as I know) understood to behave. David -- Upcoming training by David A. Black/Ruby Power and Light, LLC: * Intro to Rails, London, UK, December 3-6 (by Skills Matter) See http://www.rubypal.com for details and 2008 announcements!