Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Private, Public and Global
Message
De
15/06/2002 18:47:39
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Private, Public and Global
Divers
Thread ID:
00668953
Message ID:
00668953
Vues:
51
Hi to all,

After having had a nice conversation with JimB (Re: Public variables Thread #667392 Message #668939) I'd like to propose to the community to use g as scope indicator for variables that are declared public OR PRIVATE in the MAIN program. The g then indicates that it are GLOBAL variables. Global (g) is then simply an indicator that they're visible to the entire application. Here's an example of a main program.
*	Declare GLOBAL variables. Notice that I use the g here for PRIVATE variables. 
*	The g indicates that these variables are visible/global to the entire application.
*	The only place where private variables are allowed to start with a g is in the main program.
*	This usage of g is different from what's proposed in the vfp-documentation (where it's 
*	advised for public variables).
private goMainWindow, goNewActivity, goReports, goOptions

*	References to forms.
store null to goMainWindow, goNewActivity, goReports, goOptions

do form MainWindow name goMainWindow

read events

release all like g*
*	The ALL LIKE wouldn't work for public variables.
*	However, it's not even a necessary statement, for these variables 
*	will go out of scope anyway on return.

RETURN
Feedback please.
Groet,
Peter de Valença

Constructive frustration is the breeding ground of genius.
If there’s no willingness to moderate for the sake of good debate, then I have no willingness to debate at all.
Let's develop superb standards that will end the holy wars.
"There are three types of people: Alphas and Betas", said the beta decisively.
If you find this message rude or offensive or stupid, please take a step away from the keyboard and try to think calmly about an eventual a possible alternative explanation of my message.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform