On 22/07/15 19:20, Paul van Helden wrote:
I have never managed to understand why "declare before use" is so important
to Pascal. I get the bit about strong typing and doing everything possible
to eliminate errors at compile time, but I still don't get why. If this is
central to what makes something "Pascal", I would love to be pointed to a
good explanation. I'm not trying to be a pain here. I've been programming
in Pascal, full time, for most of my life. It has always puzzled me why
everything has to be declared first.

Consider the following code:

procedure Test;

var i : integer;

begin
  for J := 1 to 25 do
    writeln;
end;

With "Declare before use", this is plainly incorrect. J has not been declared; You can't type; You are an idiot!

In your world, it may be an error (see above), it may be a warning; I has been declared and not used. You may have warnings switched off and never even see it!

I like my compilers to find as many errors in my code as possible
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to