>>>Recently, I had to optimize/debug/verify/etc an old project written in FP 2.6.
>>>
>>>At the begining of the main program I found the following code that doesn't make any sense to me. (I also asked other FoxPro programmers from our team, but no answer was found.):
>>>
>>>parameter Cmd_Param
>>>
>>>
if type("Cmd_Param") = "C"
>>> TempVar = Cmd_Param
>>> release Cmd_Param
>>> private Cmd_Param
>>> Cmd_Param = TempVar
>>>endif
>>>
>>>I can't find any reason to have this piece of code in the program since, IMO, it does nothing. Am I missing something? Is there something subtle/secret/etc and I don't see it?
>>>
>>>Vlad
>>
>>
>>Vlad, this IS a mystery. One question comes to mind: Is the original variable used in the calling program "Cmd_Param" also? If so, then this code sets (for character-type values) the Cmd_Param variable private AT THIS LEVEL. Therefore it is now invisible to the calling program. Haven't the faintest idea why this would be wanted....
>>
>>Thanks for the puzzle.
>>
>>Barbara
>
>As I said, this is the begging of the main program. So, there's no calling program.
>
>The PARAMETER statement makes also all parameters private to the procedure. So, there's no need to make them private (I saw a piece of code recently here on UT that does that and it also made no sense to me...).
>
>Anyway, even if the PARAMETER statement would not make params private, the RELEASE would release the variable at previous level.
>
>Vlad
I'll have to start reading more carefully. Since this is at the beginning of the Main program, then it's a character variable by default, with no higher level. I think your predecessor is just confused about PRIVATE vs LOCAL. I occasionally forget, since I switch back to Clipper for some of my old clients with legacy code. Clipper used LOCALS as the default, not PRIVATE as FoxPro does.
Barbara