Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask

Re^2: Why are "push", "pop", "shift" and "unshift" so named?

by jhourcle (Prior)
on May 02, 2007 at 10:10 UTC ( #613147=note: print w/replies, xml ) Need Help??

in reply to Re: Why are "push", "pop", "shift" and "unshift" so named?
in thread Why are "push", "pop", "shift" and "unshift" so named?

Maybe I've just eaten in too many caffeterias in my life (I was a military brat, so that's quite possible), but from what I remember of caffeterias, some of them had the spring-loaded stacks for trays, not the plates.

IF you're not in a self-service buffet, but an old style caffeteria -- you'd collect the tray and utensils yourself, but as you went down the line, you'd request specific items from the caffeteria workers. They'd put it on a plate, and hand you the plate of food. So the general public only saw the use of stacks on the trays, not necessarily the plates.

These days, it's much rarer for the general public to see a caffeteria, and when you do, they've typically forgone the spring-loaded stack in exchange just a pile of trays. We do occassionally see stacks in use at self-service buffets. (some hotel restaurants, all-you-can-eat type places, etc), but it's more common in older establishments. Newer places just have a few piles of plates rather than the elegant spring-loaded stacks).


So, anyway ... I'd hardly qualify wikipedia as authoritative in these sorts of things ... and the spring-loadedness, or even what is in the stack is less important than the fact that you can only easily get to the items in the reverse order they were placed on the stack.

update: bah ... immediately after posting this, I realized that the spring-loadedness is necessary so that 'push' and 'pop' make sense in a polysemous way -- I still don't think _what_ is in the stack is necessarily significant.

update2: I was in an IHOP yesterday, and saw a spring loaded stack, but it was for bowls. (so neither plates or trays)

  • Comment on Re^2: Why are "push", "pop", "shift" and "unshift" so named?

Replies are listed 'Best First'.
Re^3: Why are "push", "pop", "shift" and "unshift" so named?
by webfiend (Vicar) on May 02, 2007 at 17:12 UTC

    It's true that you don't see the spring-loaded tray or plate stacks as much, but it's an analogy that has stuck with us. We have a similar situation with "radio buttons" in graphical interfaces. The name is losing its meaning relative to actual radios over time, but the name is still here in a particular input type.

    As far as the contents of the stack: all analogies break down sooner or later. The stack of plates is just a starting point. This is Perl, so that stack could contain plates, trays, scalars, turkeys, or small cars.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://613147]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (2)
As of 2020-10-24 09:46 GMT
Find Nodes?
    Voting Booth?
    My favourite web site is:

    Results (242 votes). Check out past polls.