Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to: Push and Pop parameters?
Message
From
19/10/2001 09:08:16
Mike Yearwood
Toronto, Ontario, Canada
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00570224
Message ID:
00570756
Views:
25
Hi Larry

I can have a routine change SET TALK from OFF to ON as long as I put it back. So, it occurs to me that I should be able to change a string parameter to an array as long as I put it back. Despite what Jay Van Santen says, switching set talk within a routine doesn't render the routine non-self documenting. If anything, having the power to control anything inside the routine makes it more self documenting. Its a bit strange that we can change the data type from string to array, but there's no way to change it back.

In any case since we are prevented from handling this situation I'll have to work with copies of the parameters.

>Hi Mike,
>Could you give alittle more explanation of what's happening and why you need this? Can you do as George suggested along this thread of having two separate logic branches for variables passed as arrays and those that are not? Why would convert a string into an array in the first place?
>
>When you pass a variable by reference, you are actually passing a pointer to the memory space that holds that variable. Anything you do to it, changes the information in that memory space. When you copy an array into it, you change the structure of what is stored there. At the end of Junk1, VFP thinks the memory location holds an array and treats it accordingly. I don't know of way to make it think otherwise.
>
>BTW, if you release tuParameter before you assign luparamater to it, you kill the reference back to lcstring. When the assignation takes place, you are creating a new private memory variable called tuParameter.
>
>>Hi All
>>
>>I need to pass a parameter to a method by reference. The called method may alter the parameter, so I want to push the parameter to a property. The parameter may be a string or an array to begin with. I don't believe the save and restore variables to memo fields / .mem files route would be feasible.
>>
>>The problem is, if an initial parameter is passed as a string and pushed to a property, and the called program changes the passed parameter to an array, it doesn't seem possible to pop the parameters so as to cause the array to become a string again.
>>
Previous
Reply
Map
View

Click here to load this message in the networking platform