Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A basic thought about LOCAL variables
Message
De
28/12/1999 20:32:43
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00309158
Message ID:
00309628
Vues:
32
I have to defend myself... :) Although I understand what you're saying (this message and others) and I also agree up to a certain point. :)

There's an important difference between variables declared as PRIVATE and variables that are not declared.

When you're saying (and others) that undeclared variables are by default PRIVATE, than everybody understands that a variable declared as PRIVATE is the same as a variabled that is not declared before being used. And this is true only if the same variable doesn't exist at a higher level. I won't discuss everything again here. You explained it very well in this thread...

All I want to say (and wanted to say in previous threads) is that an undeclared variable may introduce behavior that is different from the behavior one has with explicit PRIVATE declarations.

Or, more clear, declaring a variable as PRIVATE in a proc/func/method may change the behavior of your application. This is why an undeclared (at a certain level) variable is not exactly the same as a PRIVATE variable.

And this is the point to this discussion: whatever you do, explicitly declare all your variables using LOCAL, PRIVATE or PUBLIC (why and when to use each is a different thread :)).

Vlad

>I'm sorry, but Paul is incorrect on this one. Private is private is private and there are no variations on private. Variables created without being delcared are created as private variables. Assigning a value to a variable is not, necessarily, creating the variable. Depending on the assignment of a value to create a variable is a bad practice (but that doesn't change the simple fact that private is the default scope for variables in VFP).
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform