dlk wrote
...make all subsequent uses of the constant 1 behave as if they were instead uses of 42?
Seriously, the best thing would probably just be to pop the stack ignoring the value.
But sometimes you want to change the constant.
My first industry job was fixing bugs in an APT (NC machining) compiler. This program was written in FORTRAN II and was running on a system that was so starved for memory that every trick possible was being used to save memory usage. There were about 40 source files in the program. Because of the machine architecture, a word of memory was required for every unique constant used in each source file. To save memory, global variables IONE, ITWO, etc. were used to store commonly used constants.
One of the bugs was tracked down to code that read
IONE=ITWO
INTERP(...)
IONE=1
INTERP did interpolation of array data, and in this case it was supposed to handle every other item in the array. INTERP was full of "IONE"s and "1"s, and the bug of course, was that one of them should have been the other.
Those were the days...
--Mark