From: Bob Hutchison Date: 2007-10-24T00:01:37+09:00 Subject: Re: pop/push, shift/unshift On 23-Oct-07, at 10:52 AM, Jesús Gabriel y Galán wrote: > > I understand your explanation, but this sounds like a bug to me. I > understand the optimization part of not shifting everything in the > shift method, but if that's a desired way of working I suppose it > should be warned for the users of Array. In light of this then, the > recommended approach for queue semantics would be to use unshift and > pop? unshift/pop seems to me to be a possibility. I think it'll have to be tested though. One can easily imagine that ruby does not release allocated space in an array, as an optimisation. If this is the case then the queue will continue to grow unbound but after the end of the array instead before the start. Maybe a linked list? Cheers, Bob > > Thanks, > > Jesus. > ---- Bob Hutchison -- tumblelog at http:// www.recursive.ca/so/ Recursive Design Inc. -- weblog at http://www.recursive.ca/ hutch http://www.recursive.ca/ -- works on http://www.raconteur.info/ cms-for-static-content/home/