"no variable or argument declarations are necessary."
Duncan Booth
duncan.booth at invalid.invalid
Mon Oct 3 07:49:35 EDT 2005
Antoon Pardon wrote:
> A language where variable have to be declared before use, would allow
> to give all misspelled (undeclared) variables in on go, instead of
> just crashing each time one is encounterd.
Wrong. It would catch at compile-time those misspellings which do not
happen to coincide with another declared variable. It would give the
programmer a false sense of security since they 'know' all their
misspellings are caught by the compiler. It would not be a substitute for
run-time testing.
Moreover, it adds a burden on the programmer who has to write all those
declarations, and worse it adds a burden on everyone reading the code who
has more lines to read before understanding the code. Also there is
increased overhead when maintaining the code as all those declarations have
to be kept in line as the code changes over time.
It's a trade-off: there is a potential advantage, but lots of
disadvantages. I believe that the disadvantages outweight the possible
benefit. Fortunately there are plenty of languages to choose from out
there, so those who disagree with me are free to use a language which does
insist on declarations.
More information about the Python-list
mailing list