barrym95838 wrote:
VALUE is akin to a constant declaration
Based on the example provided, the behavior & usage of
VALUE appear identical to that of Fig-Forth
CONSTANT, so I'd say Mike's right. Which raises the question, why substitute a new name for an already-existing function?
FWIW, in my own code I sometimes (ab-)use
CONSTANT to implement what is, in fact, a variable. This boosts performance in the very common case where a value is read frequently but written to infrequently. Writes are accomplished with a
! to the Parameter Field of the so-called constant, and of course that in itself yields no benefit. But reads are accelerated because it's unnecessary to explicitly use
@. It takes one word, not two, to get that value on stack.
It's a handy trick, but the code's readability is compromised when a word defined as a
CONSTANT returns a value which is
not constant. Maybe that's why the less suggestive name
VALUE was substituted. (Corrections and additional info welcome! I have not kept up to date on standards discussions.)
-- Jeff
_________________
In 1988 my 65C02 got six new registers and 44 new full-speed instructions!
https://laughtonelectronics.com/Arcana/ ... mmary.html