I understand declaring solve problems and make for a simpler compiler, and sometimes easier to follow code.freak wrote:The rule that things must be declared before they are used has existed since the beginning (even before the Declare keyword even existed).
But this isn't a rule. It's a necessity. Maybe a necessity you happen to like. In fact there is not a rule in PB stating I must declare every procedure before I define it.
There is not.
It's just a necessity because forward referencing a procedure before its definition pose a problem for the compiler, since it's a single pass compiler.
In case of the declare for procedure it makes also for redundancy and the need to keep the same information updated in two places.freak wrote: And it is a useful one too: While it forces you to write a little more it makes the code easier to understand by humans.
I for one I would do happily without it, since I don't go to examine the declare if I want to know what a forward referenced procedure does.
I jump to its body (sound like a pervert).
This is something I understand, I can relate to and I mentioned often in my posts. Even if I would prefer to strike for balance.freak wrote: Hard to understand compiler behavior leads to more coding errors. I prefer a little more typing in this case.
Anyway all this doesn't answer my question:
Are you telling me you added the requirement of declaring procedures (and not always, mind you) because you wanted to and not because the compiler is single pass ?
And if the answer is yes, how could you have avoid it ?