Define Class Test As Session Protected Function Init() _VFP.LanguageOptions = 1 EndFunc Function Test1 x = 1 && Error ? x ? This.Test2() EndFunc Function Test2 Return x && Error EndFunc EndDefine
Define Class Test As Session Protected Function Init() _VFP.LanguageOptions = 1 EndFunc Function Test1 LOCAL x x = 1 && OK ? x ? This.Test2() EndFunc Function Test2 Return x && Error EndFunc EndDefine>I don't beleive you got me right, my wish was to have a new sys() function to changed the default behavior of VFP from creating all undeclared variable as LOCAL to the function declaring it:
>Define Class Test As Session > > Function Test1 > x = 1 > ? x > ? This.Test2() > EndFunc > > Function Test2 > Return x && x is private so no error here > EndFunc > >EndDefine >>
>ox = CreateObject("Test") >=ox.Test1() > >Define Class Test As Session > > Protected Function Init() > =Sys(9999, 1) && New sys function > EndFunc > > Function Test1 > x = 1 > ? x > ? This.Test2() > EndFunc > > Function Test2 > Return x && x an error here, x is local to test1() > EndFunc > > >EndDefine >