* shon@soc-soft.com shon@soc-soft.com [050512 09:10]:
0 > ok 0 > " hi" " hello" " bye" " welcome" ok 8 > .s <8> 4005810c 2 4005800c 5 4005810c 3 4005800c 7 ok 8 >
Above the strings " hi" and " bye" are stored at the same address(0x4005810c) and also " hello" and " welcome" are stored at the same address(0x4005800c).This means that the first two strings " hi" and " hello" are overwritten and therefore lost. Strings defined using ' s" ' also show the same behavior.
The words reading strings from the interpreter into memory are using a "pockets" implementation with two alternating string buffers. This means if you want to put more than two strings on the stack without touching them in between you need to create a copy of those strings. Think of it as a temporary string buffer.
Is this an intended behavior? Please verify the same.Q
It is indeed intended, since many forth engines do this the same way. If it is not sufficient, you can raise the number of pockets in forth/bootstrap/bootstrap.fs. Go look for: \ pockets implementation for 7.3.4.1
If you have some reasonable sample code that needs more pockets rather than becoming overly complex, we can raise the number of pockets in the official tree.
Regards, Stefan