"no variable or argument declarations are necessary."

Antoon Pardon apardon at forel.vub.ac.be
Mon Oct 3 15:58:33 CEST 2005


Op 2005-10-03, Duncan Booth schreef <duncan.booth at invalid.invalid>:
> 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.

Fine, it is still better than python which will crash each time
one of these is encountered.

> 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.

I don't think anyone with a little bit of experience will be so naive.

> Moreover, it adds a burden on the programmer who has to write all those 
> declarations,

So? He has to write all those lines of code too.

People often promote unittesting here. Writing all those unittest is
an added burden too. But people think this burden is worth it.

I think writing declaration is also worth it. The gain is not as
much as with unittesting but neither is the burden, so that
balances out IMO

> and worse it adds a burden on everyone reading the code who 
> has more lines to read before understanding the code.

Well maybe we should remove all those comments from code too,
because all it does is add more lines for people to read.

> 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.

Which is good. Just as you have to keep the unittests in line as code
changes over time.

-- 
Antoon Pardon



More information about the Python-list mailing list