The time saved not doing LOCAL INT n is wasted waiting for the run time error handler to pick up a typo. Surely you must appreciate the fact that when you try and close a method it will warn you immediately if you mistyped a command. Wouldn't it be nice if it could also tell you when you mistyped a variable!
Also, the one issue we are forgetting here is speed. I am usually the last one to bring up speed as a factor when it comes to programming conventions and methodologies, but a little more discipline (and typing) on our part could generate a significant performance boost. When the run-time engine knows the datatype it is dealing with it can be far more efficient than dealing with Variants all the time.
I agree that we should only need to declare them when their needed (as in C++). I don't think a declaration section at the top of the program is the best solution. But if I can generate faster code that the compiler can check immediately for typos, I'm not against typing the extra few characters to declare their type. Hey, we could get rid of the hungarian notation completely then if we wanted to.
Darrel
>I agree with Dorris on this one. I used Clipper 5.x where (according to in-house standards, not required by Clipper) every variable had to be declared.
>Whether or not it was strongly typed was of very little importance relative to the HOURS debugging old code where variables were just 'used' when they were needed.
>
>I try to declare major variables for any programmers unlucky enough to have to work with my code in the future, but I'm grateful I can throw in a
>
>FOR n = 1 to 25
>
>without worrying where n came from and was it a character variable before.
>
>Now MY pet peeve is the need for a form-wide variable. Sometimes it just isn't convenient to use a form property....
>
>Barbara
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement