Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
A basic thought about LOCAL variables
Message
De
29/12/1999 14:46:34
 
 
À
29/12/1999 10:48:08
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00309158
Message ID:
00310037
Vues:
37
>Hi Jim,
>
>This is my last try, then I will be wrong :-)
>
>>There is no way for the calling program to address the private variable...
>
>Ok
>
>>...because before the calling program is back in control the private variable is released from memory.
>
>I would say no. The behavior you decribed is true, but the reason (IMO) is because program above it just cannot see it even while it is in scope. But PUBLIC variables can be seen. That is a difference between the scope of the two. Using the Locals window this can be seen because it has a combobox that lets you choose which routine you would like to see visible variables for.
>
>Here is a Bitmap with what I think is hard cold evidence of this (it shows the Locals window and Trace window; take not of the value of the combo "Locals for"): http://208.230.170.137/mgh/jimb.bmp
>
>How would you argue against that?
PUBLIC cBlockMyVar
cBlockMyVar = 'Original version'
DO Test1 WITH cBlockMyVar,1
DO Test1 WITH (cBlockMyVar),2
DO Test2 WITH 'Test Value'
? "Main cBlockMyVar =",cBlockMyVar

*Test 1
PROCEDURE TEST1
LPARAMETER cMyVar,iteration
? "t1",iteration, "cMyVar TYPE = "+ TYPE('cMyVar')
? "t1",iteration,"cBlockMyVar TYPE = "+ TYPE('cBlockMyVar')

PROCEDURE Test2
LPARAMETER cBlockMyVar
? "t2 cBlockMyVar =",cBlockMyVar

Run under VFP6 output looks like:

t1          1 cMyVar TYPE = C   
t1          1 cBlockMyVar TYPE = U    
t1          2 cMyVar TYPE = C   
t1          2 cBlockMyVar TYPE = C    
t2 cBlockMyVar =   Test Value
Main cBlockMyVar =   Original version
So PUBLIC ain't always so public...
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform