Sujet : Re: Avoid treating the stack as an array [Re: "Back & Forth" is back!]
De : albert (at) *nospam* spenarnc.xs4all.nl
Groupes : comp.lang.forthDate : 15. Sep 2024, 10:53:09
Autres entêtes
Organisation : KPN B.V.
Message-ID : <nnd$2003c11f$2eb36b6a@f7bd4c449064e4a3>
References : 1 2 3 4
User-Agent : trn 4.0-test77 (Sep 1, 2010)
In article <
66e67077$1@news.ausics.net>, dxf <
dxforth@gmail.com> wrote:
On 14/09/2024 10:32 pm, Anton Ertl wrote:
The heavy use of global variables in this program also does not
support the idea that proper usage of the stacks makes locals
unnecessary.
>
I see many small colon definitions and very few variables - global or
local:
>
integer #TERMS \ number of terminals in DTA file
integer TERM \ working terminal#
variable #DIGIT
variable LEN
integer MAXCHR
>
The first two are necessarily global and would exist regardless.
The remaining three are used by a group of functions with the view of
keeping them simple. The alternative would be to carry them around as
parameters shuffling them from one function to another. That seems
worse to me.
One anecdote. I had a project that consisted of squashing bugs.
Proud to say that I accurately predicted the timing of each bug
separately and I was not 5 % off for the total.
One bug I refused to get a timing estimate on.
This program was written in c by lispers, and they didn't understand
that some variables are group-local, i.e. in fact global.
There was a variable ERROR , and once set the second time there
was an error this was inspected, and the program was supposed to give up.
The lispers went recursively about it and kept defining new ERROR
that were initialised to false. In case of an error,
this program never stopped.
Groetjes Albert
-- Temu exploits Christians: (Disclaimer, only 10 apostles)Last Supper Acrylic Suncatcher - 15Cm Round Stained Glass- Style WallArt For Home, Office And Garden Decor - Perfect For Windows, Bars,And Gifts For Friends Family And Colleagues.