On Apr 3, 12:23pm, Clive Page wrote:
> Subject: Re: New ideas (was Re: A more regular syntax and subset)
> On Fri, 3 Apr 1998, Dr W.W. Schulz wrote:
>
> > Concerning a possible Fortran Subset:
> >
> > One requirements should be: Fortran keywords are reserved.
>
> I am against this for two reasons:
>
> 1. It is liable to make existing programs invalid when a new language
> standard is brought out, if the code just happens to use as a symbolic
> name something that is suddenly defined as a new reserved word.
Well, we have the same problem with respect to intrinsic-function names
already. So I'm not sure this is that big a problem.
> 2. It makes problems for beginners, if they have to be told: you can use
> anything you like as a variable name, except this list of (several dozen
> names)....
In lesser degree, intrinsic function names cause the same problem.
The beginner's code will still work if he uses one of these as a
variable name, but if he later wants to use the intrinsic of the
same name in the same scope, he has to do some renaming.
> I find that beginners often like to use names
> like DATA or SAVE for their variables, and it works fine (though
> of course I do tell them this isn't actually a good idea).
And if they want to follow your advice, they have to treat them
as reserved, anyway. And if they want to follow your advice, but
don't remember the list, they have to look them up. And if they
forget to look them up, nothing in Fortran warns them that they
shouldn't have used them. And if reminded, they would probably
not use them. And making them reserved is a darn good way of
reminding them.
IMHO, there are plusses and minusses on both sides, but one additional
plus for making words like DATA and SAVE reserved is that then,
if a term like this is used in the wrong context, a compiler error
will result. Right now, the usage is accepted, and the program will
still work correctly, but the (perhaps naive) programmer would probably
say, if reminded what he had done, "Damn -- I didn't really mean to do
that."
I inherited a large application in which "INDEX" is used as a variable
in many procedures. I remember what I had to go through when I first
wanted to use the intrinsic function of that name in one of these
procedures. Well, it wasn't really so bad, to be honest: all I had
to do was a global change of INDEX to INDX in an editor (after making
sure, of course, that INDX wasn't already used for something else).
If this is the worst consequence of having a variable or function
name become invalid because it became reserved, it frankly ain't
so bad.
One would also have to be convinced of the *advantage* of having
reserved words; but the disadvantage, to my mind, is small.
-P.
--
************** In memoriam, Grandpa Jones, 1913-1998, R.I.P. **************
* Peter S. Shenkin; Chemistry, Columbia U.; 3000 Broadway, Mail Code 3153 *
** NY, NY 10027; [log in to unmask]; (212)854-5143; FAX: 678-9039 ***
*MacroModel WWW page: http://www.columbia.edu/cu/chemistry/mmod/mmod.html *
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|