From: Trans Date: 2007-10-23T21:45:26+09:00 Subject: Re: pop/push, shift/unshift On Oct 22, 11:53 pm, "Simon Schuster" wrote: > the inconsistency in naming bothers me. :P I would imagine that it > comes from push/pop being older, and shift/unshift being added later > (probably I would guess that both of these are pre-ruby programming > ideas. I know I've seen push/pop before.) > > I would like to see either push/pop changed to be > something/unsomething, or shift/unshift changed to be um, visualish > ideas of what's going on (or whatever push/pop is.) my preference > would be push/pop changed to something/unsomething. or maybe > front_add, front_del, back_add, back_del. > > just trying to get a gut-grip on these four array processes, and I'm > pushing and popping and shifting and unshifting left and right (and > back and forth?) and it's taking a surprising amount of time to "grok" > them. does anyone think this is a naming convention that could benefit > with some change, or am I just being strange? Some things you just have to get used to. And some things are worth getting used to ;) I think push and pop are worthy, but I've never come to terms with shift and unshift. Not only do they seem backwards to me, but the words themselves have little mnemonic value. In my work I often alias shift as pull. That fits nicely with push and pop. Unfortunately I've yet to find a better substitute for unshift. I've tried things like 'pot' (for put on top) and 'place', and more recently 'poke', though traditionally that is more akin to insert, but nothing has really stood out as of yet. T.