Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How can I append without opening the edit window?
Message
De
28/06/2001 11:26:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivie
 
 
À
28/06/2001 11:08:32
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
Base de données, Tables, Vues, Index et syntaxe SQL
Divers
Thread ID:
00524283
Message ID:
00524732
Vues:
16
>How difficult ? Why would I need the local declaration ? You mean it's sufficient to declare a memvar to make it available after method/event routine ends ??? If so how ?
>
>scatter memvar memo
>
>It's this simple since fox2.x (not seen fox1x).
>Cetin

No, I don't want to have the variable available after the method ends (this could be done by declaring the variable PUBLIC).

What I do try to do is to avoid variables from other procedures from being overwritten. In this sense, LOCAL is similar to PRIVATE. Imagine the following scenario:

Procedure_A declares a variable "Client_Code"
Procedure_A calls Procedure_B
Procedure_B issues a SCATTER, and changes the value of variable "Client_Code"
Procedure_B finishes
Procedure_A produces hard-to-debug errors, because the value of "Client_Code" changed.

This can be solved by issuing one of the following in Procedure_B:
local Client_Code
   or
private Client_Code
This way, Procedure_B uses its own copy of the variable, and doesn't overwrite the variable of Procedure_A.

Of course, it is quite possible you never encounter this situation, so "take it or leave it". However, I find it better to program "defensively": it is often better to avoid an error in the first place, than to debug it later.

And, since you would have to declare several LOCAL or PRIVATE variables, a single variable (SCATTER ... NAME) is much easier.

Regards, Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform