Almost forgot this one.  My abandonment of one-byte variable names isn't in
pursuit of better self-documentation (though it does contribute a little to
that); it's because once in a REXX program I had a variable X and tried to
concatenate it to a string:

  result='string'x

I struggled for a long time with this before I realized that REXX had
interpreted 'x' not as the variable name but as a hex indicator.  (To make
it worse, I think the string literal I happened to be using was actually a
valid hex string.  Figuring out the error took me a ~long~ time.)  I have
ever since eschewed one-byte names for any purpose whatever, not only in
REXX but in every other language.  For those casual little variables that
are used only within the range of a handful of statements (one "paragraph",
I often call it) I use two bytes.

An overreaction, no doubt, but as it turns out it's been helpful in a few
small ways.  Now my casual variables are named v-something: vt for a time,
perhaps, vn for a name, vr for a row.  But I've also gotten into the habit
of using p-something for a character position and l-something for a string
length.

And for all loop variables I use not i-something -- I tried that at first,
but there are too many two-letter reserved words beginning with 'i' (IF, IN,
IS) -- but j-something: jr for a row, ja for an ACID, jp for a profile,
whatever.  Again, it's a small help, but it works for me.

---
Bob Bridges, [email protected], cell 336 382-7313

/* "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: IBM Mainframe Discussion List <[email protected]> On Behalf Of
Arthur
Sent: Tuesday, June 15, 2021 23:11

My first languages were BASIC & Fortran, and I still see nothing wrong with
loop variables of I, J, & K.

For anything more complex, I do use names that make sense. 
Or I try to. I recently rewrote a program and had to figure out what some
variable names meant. I kept the names (because they *were* descriptive),
but included a block comment at the beginning explaining them.

--- On 15 Jun 2021 15:07:15 -0700, [email protected] (Bob Bridges)
wrote:
>1) I used to hate long-winded variable names.  Ok, that's a bad example 
>to start with, because I still do.  But I no longer use one-character 
>variable names, ever

----------------------------------------------------------------------
For IBM-MAIN subscribe / signoff / archive access instructions,
send email to [email protected] with the message: INFO IBM-MAIN

Reply via email to