Poll: What should happen with LIST-> when an overflow happens?
It should not give the LIST-> if an overflow will happen
It should warn the user, then do it
It should just overflow off the top
Something else
[Show Results]
Note: This is a public poll, other users will be able to see what you voted for.
Post Reply 
What to do with stack overflow OBJ->/LIST->?
06-20-2016, 09:30 PM (This post was last modified: 06-20-2016 09:34 PM by Tim Wessman.)
Post: #1
What to do with stack overflow OBJ->/LIST->?
In RPN mode on Prime, you have a ->LIST command in the menu stack menu to build a list. (Type 1 2 3 4 5 ENTER, then press UP and click the "Stack" menu screen button). You can move up and build a list.

There is no direct way to get content out of that list with OBJ-> or LIST-> or similar. Please see http://www.hpmuseum.org/forum/thread-6415.html for the most recent discussion.

I'd like to correct this, but would like some feedback. Currently, there is a limit of 128 items in the stack. What should happen if you have too many items in your list that it will overflow the stack and lose items at the top?

Example: You have a list of { 1,2,...999}
Example: You have a list of { 1,2,...126} and already have 10 items in the stack.

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
06-21-2016, 01:57 AM
Post: #2
RE: What to do with stack overflow OBJ->/LIST->?
(06-20-2016 09:30 PM)Tim Wessman Wrote:  In RPN mode on Prime, you have a ->LIST command in the menu stack menu to build a list. (Type 1 2 3 4 5 ENTER, then press UP and click the "Stack" menu screen button). You can move up and build a list.

There is no direct way to get content out of that list with OBJ-> or LIST-> or similar. Please see http://www.hpmuseum.org/forum/thread-6415.html for the most recent discussion.

I'd like to correct this, but would like some feedback. Currently, there is a limit of 128 items in the stack. What should happen if you have too many items in your list that it will overflow the stack and lose items at the top?

Example: You have a list of { 1,2,...999}
Example: You have a list of { 1,2,...126} and already have 10 items in the stack.

All commands should probably throw a "Stack Overflow" error, which the user can catch with an IFERR statement, and which could be disabled via a flag.
It should be handled the exact same way you are handling ALL commands when the stack overflows. If you have 128 items (full stack) and you do a DUP, what happens on current firmware?

Even on the "infinite" stack of the 50g, if you run out of memory you get an out of memory error thrown, same thing would be expected on the Prime. As long as it's consistent and documented, people will work around the stack limitation.
If you have 10 items on the stack, then you expand the first 118 elements of the list, and when trying to push the 119, it would blow with the "stack overflow" error (or if the flag disables it, just overflow and lose the bottom item).
Since the user chooses the flag setting, the user will be fully aware of what happens and the implications of the overflow.

I don't think you have this option in the poll, I bet most people would agree this is the best way to handle it.
Find all posts by this user
Quote this message in a reply
06-21-2016, 06:52 AM
Post: #3
RE: What to do with stack overflow OBJ->/LIST->?
I agree there should be a stack overflow warning as per 50g. On a related point, is there a specific reason the stack is limited to 128, whereas the 50g is limited only by memory?
I guess the prime could also have a quasi unlimited stack. Behaviour could then be essentially the same as 50g
Find all posts by this user
Quote this message in a reply
06-21-2016, 08:43 AM
Post: #4
RE: What to do with stack overflow OBJ->/LIST->?
(06-21-2016 01:57 AM)Claudio L. Wrote:  All commands should probably throw a "Stack Overflow" error, which the user can catch with an IFERR statement, and which could be disabled via a flag.
It should be handled the exact same way you are handling ALL commands when the stack overflows. If you have 128 items (full stack) and you do a DUP, what happens on current firmware?

Currently, the 128th item silently disappears off the top of the stack. My first thought was, "Well, that's not good." My second thought was, "You know, that's what the 41C did, and it only had 4!"

I do recall once writing a 50g program that temporarily put a BUNCH of items on the stack, but that was in a program. Am I correct that on the Prime, OBJ-> would be for interactive use only? If so, 128 is quite large for interactive use. I suspect it would be exceedingly rare for anyone to interactively bump up against the 128 limit.

As long as the limit is documented, then I don't see a problem with items dropping off the top of the stack.

Any reason why the stack is limited to 128? Would it be easier to increase the limit, say 1024, or put in error trapping code?
Find all posts by this user
Quote this message in a reply
06-21-2016, 12:20 PM
Post: #5
RE: What to do with stack overflow OBJ->/LIST->?
(06-20-2016 09:30 PM)Tim Wessman Wrote:  In RPN mode on Prime, you have a ->LIST command in the menu stack menu to build a list. (Type 1 2 3 4 5 ENTER, then press UP and click the "Stack" menu screen button). You can move up and build a list.

There is no direct way to get content out of that list with OBJ-> or LIST-> or similar. Please see http://www.hpmuseum.org/forum/thread-6415.html for the most recent discussion.

I'd like to correct this, but would like some feedback. Currently, there is a limit of 128 items in the stack. What should happen if you have too many items in your list that it will overflow the stack and lose items at the top?

Example: You have a list of { 1,2,...999}
Example: You have a list of { 1,2,...126} and already have 10 items in the stack.

I'd like the Prime to use all available memory for the stack but in the absence of that capability, an Out of Memory or Stack Overflow error would be appropriate.

Tom L

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
06-21-2016, 02:16 PM (This post was last modified: 06-21-2016 02:23 PM by Tim Wessman.)
Post: #6
RE: What to do with stack overflow OBJ->/LIST->?
(06-21-2016 01:57 AM)Claudio L. Wrote:  All commands should probably throw a "Stack Overflow" error, which the user can catch with an IFERR statement, and which could be disabled via a flag.

Well, that would be the correct behavior except this is not a command or anything that is programmable. It would be purely in a small menu item that appears in the UI when browsing the stack using the "UP" key to go up and select items. There is no "DUP" command nor anything that directly interacts with the stack in a program.

The current behavior is when you press ENTER to make a copy, the top of the stack falls off (like any 4 level RPN machine, just with more levels).

TW

Although I work for HP, the views and opinions I post here are my own.
Find all posts by this user
Quote this message in a reply
06-21-2016, 05:14 PM
Post: #7
RE: What to do with stack overflow OBJ->/LIST->?
(06-21-2016 02:16 PM)Tim Wessman Wrote:  Well, that would be the correct behavior except this is not a command or anything that is programmable. It would be purely in a small menu item that appears in the UI when browsing the stack using the "UP" key to go up and select items. There is no "DUP" command nor anything that directly interacts with the stack in a program.
Oh, I see.

(06-21-2016 02:16 PM)Tim Wessman Wrote:  The current behavior is when you press ENTER to make a copy, the top of the stack falls off (like any 4 level RPN machine, just with more levels).

That's it, just keep this behavior consistent across all commands, document it and done.
Find all posts by this user
Quote this message in a reply
06-22-2016, 05:02 AM
Post: #8
RE: What to do with stack overflow OBJ->/LIST->?
Hello,

?? 128 stack size limit ??

Yes, there is a reason...

The HP 39GII had a very limited memory, and, a recurring problem of the HP39G+/HP40G was customer complaining of out of memory condition caused by the fact that they had thousands of objects on the stack.

So, when the 39GII was created, we simply pre-allocated 128 stack levels for input/outputs. It made sense there.

When Prime came along and we added RPN, the same 128 stack structure was kept (made thing easier/faster)... At the time, we designed RPN as an entry system, not a programming one, therefore thinking that 128 stack levels ought to be enough for everyone...

And here you have it. This is the reason. This is not an excuse, nor a justification, it is just... the reason...

Cyrille


Cyrille

Although I work for the HP calculator group, the views and opinions I post here are my own. I do not speak for HP.
Find all posts by this user
Quote this message in a reply
06-22-2016, 07:30 AM
Post: #9
RE: What to do with stack overflow OBJ->/LIST->?
(06-22-2016 05:02 AM)cyrille de brébisson Wrote:  And here you have it. This is the reason.

Seems logical to me.
Find all posts by this user
Quote this message in a reply
06-22-2016, 07:44 PM
Post: #10
RE: What to do with stack overflow OBJ->/LIST->?
(06-22-2016 05:02 AM)cyrille de brébisson Wrote:  When Prime came along and we added RPN, the same 128 stack structure was kept (made thing easier/faster)... At the time, we designed RPN as an entry system, not a programming one, therefore thinking that 128 stack levels ought to be enough for everyone...

Cyrille

I can't think of an equation I use regularly that comes close to the 128 level limit. If someone here has one, let's see it! It must be a doozy!

Tom L

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)