Liste des Groupes | Revenir à cl forth |
Stack jugglery means wasting CPU cycles for>
moving the bytes around - it's contrproductive.
Variables have been invented to be used. They're
useful, if you didn't notice, or if they didn't
tell you that in your college, or wherever.
Forth uses variables in the global sense and this works well.
Variables at the word level is often an indication something is
wrong.
"As as result of Forth's heavy use of the stack
for parameter passing and the efficiency with which
the stack operators execute, it is easy for the beginner
to run away with the idea that the stack operators should
be employed at every opportunity. This is not the case,
the key to good Forth programming being structure and
simplicity of coding achieved through correct analysis
of the problem. Part of the beauty of Forth program is
the ease with which they can be maintained and adapted
to cope with new circumstances, due to their extreme
modularity. A major factor in program maintenance is
the readability of the code and this is certainly not
helped by massive clusters of stack operators. The use
of named variables, whilst consuming more dictionary
space and executing more slowly, leads to far more
readable source code and often to a better factored
and ultimately more efficient application. This becomes
ever more significant the larger the application."
(R. Olney, M. Benson - "Forth Fundamentals" - chapter
7.4. "Stack versus variables")
Your talk with Marcel reminded me the above.
Les messages affichés proviennent d'usenet.