>reading a recent post, I read ( then proved ) that if you declear a private var in you main program it will have golbal scope.
>
>WHY!!!?!?!?!
>
>unless I'm mistaken, in most ( if not all ) other programming languages when you declair a private var it is scoped to that file, method, function, etc. I should be able to declair the Var isSomeThing as private anywhere in the program, and anywhere else ( other than that function, etc. ) isSomeThing should not exist, irregardless of how it came to that piece of code ( even if it is in the main.prg file ).
>
>I don't understand why the deviation on something so primitive.
>
>- jer
PROCEDURE foo
PUBLIC gcVar
gcVar = "This is public"
PRIVATE pcVar
pcVar = "This is private"
? gcVar
? pcVar
RETURN
In the Command Window
DO foo
? gcVar -----> "This is public"
? pcVar -----> Variable not found
The PRIVATE variable is visible only as long as the program which created it is in the call stack. If that is the main program of your application and you QUIT when the application ends then it is equivalent to PUBLIC
for the purposes of your applicationThe PUBLIC variable is still visible even after the program which created it ends.