Willem <> writes:
> Keith Thompson wrote:
> ) pop() not returning a value makes some sense if you think that
> ) shrinking the stack and retrieving the top element should be
> ) separate operations.
>
> push() not taking a value makes some sense if you think that
> expanding the stack and setting the top element should be
> separate operations.
*And* if you don't mind the new top of the stack having a meaningless
value. The two cases are not equivalent.
> ) default value onto the stack.
>
> pop() without a return value would have to discard the value it
> takes from the stack.
Of course. Sometimes that's what you want to do.
I'm not arguing that pop() *shouldn't* have a return value, just
that it's not entirely insane for it not to.
--
Keith Thompson (The_Other_Keith)
kst- <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"