>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.
That makes sense. OTOH, I have seen the framework I use (Visual Extend) declare variables in the main program explicitly as public - the whole issue gets sidestepped this way!
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)