On Dec 2, 2007, at 1:44 AM, David A. Black wrote:

> 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
I understand where you're coming from completely with the tradition  
and convention, but sometimes tradition could be broken.
I was just being hypothetical, after playing with Cocoa and Objective- 
C lately, where most container classes come in mutable and immutable  
varieties, methods there to work on immutable containers have no  
choice but to return a new container. (where the new one can be  
either mutable or immutable, since creation uses the same shared  
initializer)
Just to illustrate the point if there were a purpose for ! with push  
and pop.
Since we don't have immutable containers in Ruby, there's not a point  
to these methods having a bang.
They inherently bang.
Just a hypothetical.
Since Ruby is Ruby, the flavor is distinctly mostly mutable  
objects... yummy!