Your point is well taken, Adrian, but personally I stopped having much
trouble with loop indices since I abandoned one-letter names for short-term
variables. I used to name indices i, j, k and so forth, and would
frequently use x, y and z for values that I saved over no more than a line
or two. But one day I discovered that 'x' isn't a great idea because
sometimes I have to use it up against a string constant and then REXX thinks
I'm specifying a hex constant instead. So I started using two-letter
variable names, usually v-something instead of x, y and z and i-something
for my indices.
That worked great in REXX - REXX doesn't care if my loop uses 'is', 'if' or
'it' for an index - but it doesn't work so well in VBS and other languages,
so I switched to j-something. After that I didn't have to think about it
any more.
For me the problem is in other standard names. If I'm writing a REXX to
manipulate ACF2 data then LID and/or TYP are very likely to be used in the
main routine and in subroutines. If I'm not thinking about it, I may use
LID in the main routine and then supply an argument to a function that
accepts one of its parms as LID, too; voilą, my main program is confused.
When I think about it I add some sort of kludgy prefix to all the names in
the subroutine, but it's long past time I got into the habit of using
PROCEDURE by reflex and making NOT using it the exception.
/* "I will tell you what I say", answered Ransom, jumping to his feet. "Of
course good came of it. Is Maleldil a beast that we can stop His path, or a
leaf that we can twist His shape? Whatever you do, He will make good of it.
But not the good He had prepared for you if you had obeyed Him. That is
lost forever. The first King and first Mother of our world did the
forbidden thing; and He brought good of it in the end. But what they did
was not good; and what they lost we have not seen." -from Pelelandra by C S
Lewis */
-----Original Message-----
From: Adrian Stern
Sent: Monday, April 9, 2012 13:26
There is no down side and if you're as lazy as I am you should use it so
that the favourite variable i ( do i=) can be used over and over without
problems and without having to find another letter - passing variables and
expose for stems solve any isolation problems.
-----Original Message-----
From: Bob Bridges
Sent: den 9 april 2012 19:16
An epiphany has just broken upon me. I've been writing in REXX for almost
twenty years, and it's only exceptionally that I use PROCEDURE; normally I
do without, but stick it in where it seems to be needed. Of course, that
way I have to deal with the occasional need to think about the names I use
inside functions and subroutines, and sometimes I forget and have to figure
out why my program isn't working right.
But suddenly I'm not sure why I've been doing it that way. Ok, sure, it
makes it easier to access main-routine variables, but EXPOSE can do that
with minimum difficulty. I'm minded to change my habits.
But hasn't there been some discussion here about the PROCEDURE statement?
Someone tell me why I SHOULDN'T start using it, please. The reasons needn't
be persuasive; I just want to hear the down side before changing over.