From: Martin DeMello Date: 2002-11-26T23:26:31+09:00 Subject: Re: RCR: Stack, Queue alias methods in Array Nat Pryce wrote: > On Tue, 2002-11-26 at 09:46, Martin DeMello wrote: >> Rationale: Ruby arrays can be easily used as stacks and queues, but it's >> distracting to have to stop and think about which end of the array >> you're working with. >> >> Proposed aliases: >> >> top <- last >> enqueue, append <- push >> dequeue <- shift >> head <- [0] >> tail <- last > > How about defining these in modules, so that they can be included into > individual arrays or into the entire array class if needed. They're not really new functionality, though, just aliases for existing methods. And 'push' and 'pop' are already part of Array - it seems a bit heavy conceptually to include a module just to 'alias top last'