[Info-vax] Variable declarations, was: Re: improving EDT
Scott Dorsey
kludge at panix.com
Sat Nov 19 16:12:22 EST 2016
Simon Clubley <clubley at remove_me.eisner.decus.org-Earth.UFP> wrote:
>On 2016-11-18, David Froble <davef at tsoft-inc.com> wrote:
>>
>> I've had many criticize me for not declaring all variables. My response has
>> been "that's the compiler's job, why should I do such work?". Nothing different
>> in having tools that attempt to do the grunt work for you.
>
>They are absolutely right to criticise you IMHO. Declaring variables
>is protection against some types of silly typing errors and in more
>modern traditional style languages this is a requirement (or you
>get an undeclared variable error during compilation).
Back in the 1960s there was a valid argument for automatic variable
assignment, and back then there were compiler listings and everyone
was warned to be very very careful to make sure that there weren't
any spurious variables showing up on their listings.
Today modern compilers and debugging practices that came into existence
in the 1970s and 1980s make listings far less important and one of those
things is forcing explicit declarations.
If you're using a language that will automatically set up undeclared
variables for you, it's just a matter of time before you accidentally
typo that comma and write:
DO 10 I=1.5
which is an assignment statement and not a loop statement. And if you
don't notice this new DO10I variable that shows up on your listing, you
are going to be in for a world of hurt.
--scott
--
"C'est un Nagra. C'est suisse, et tres, tres precis."
More information about the Info-vax
mailing list