|ENTER vs. DUP - stack lift or not?|
Message #22 Posted by Marcus von Cube, Germany on 28 June 2011, 6:27 a.m.,
in response to message #21 by Paul Dale
The discussion about the command line rises another question that is not only interesting to WP 34S but to all newer RPN calculators that handle an input line.
In the good old days, there was no distinction between the input line and the X register. ENTER is always a DUP which disables stack lift. If you type 1 ENTER 2 + you get 3 because the 2 after ENTER replaces the 1 in X. Typing 1 ENTER + returns 2. We all know this behavior well.
Now to the newer generation. Let's talk about RPL first. There is no concept of disabled stack lift at all. ENTER isn't a DUP anymore, at least not after entry of some data on the input line. It just commits what is there. If it is a number or if it generates one through evaluation, this goes to the stack. ENTER duplicates as DUP if no command line entry is present. This is just a shortcut. Our examples from above now work slightly differently then before. If you type 1 ENTER 2 + you get 3 because + does an implicit evaluation of the input line before it executes. The result is the same as before. Typing 1 ENTER + returns the sum of 1 and whatever is on the next higher stack level. Here things behave differently.
What about more recent RPN (not RPL) calcs? Some testing revealed that most of them (27bii+, 32S, 33S, 35S, 42S) behave the old way. On the last three you have a visible feedback so the behavior is obvious to the user.
The 20b and 30b change the game. Here 1 INPUT + returns 1 if the stack has been cleared before and not 2 as one could expect from an RPN machine. INPUT just commits the input line to X but leaves stack lift enabled. 1 INPUT 1 + behaves as expected. It occurs to me that there is not concept of a disabled stack lift in these calculators at all. 1 INPUT INPUT 2 INPUT leaves 1 in Y, 1 in Z and 2 in X. This is exactly what RPL would do here.
What is your preferred behavior? I start liking the way the 20b and 30b work.