6

I would like to know which of the following expressions are not correct and why:

  1. push onto the stack
  2. push onto stack
  3. push on the stack
  4. push on stack

Is there a good guide or rule on how to use onto?

1 Answer 1

5

In programming contexts, the idiomatic phrase is "push onto the stack".

The stack is a metaphor, like a stack of poker chips. A poker chip is put onto the stack of chips, that is, placed on the top of the stack.

In real life, we usually remove the topmost item from a stack when we need to take an item from one. Hence its applicability to last-in-first-out programming scenarios. It's the opposite of a so-called FIFO queue (first in first out).

4
  • If the "stack" is something like a stack of poker chips, and you move them across the poker table, then you could say "push on the stack".
    – user3169
    Commented Jan 16, 2015 at 19:18
  • I don't know why, but in programming circles, they use the verb "push" to mean place. Items are pushed onto the stack" and popped from the stack. google.com/…
    – TimR
    Commented Jan 16, 2015 at 20:07
  • The OP needs to specify what "stack" means in the given examples. As is I would close this as needing more details.
    – user3169
    Commented Jan 16, 2015 at 20:45
  • 1
    It recognizable as a collocation from a specific domain. But have fun closing it if that's what pleases you.
    – TimR
    Commented Jan 16, 2015 at 20:58

You must log in to answer this question.