Mike Yearwood
Toronto, Ontario, Canada
General information
Category:
Coding, syntax & commands
Hi Mike --
Interesting questions. Looks like you're running up against some of the boundaries of the Fox.
As a design decision, I don't change the data type of a parameter within a routine. That's a "side effect" of a subroutine that's not self-documenting and could cause problems down the road.
A couple of ideas:
1. In the method that does the conversion, can you use a local variable for its own processing?
2. Can you pass the value as an object with 2 different data types, the string or the array, and have each method use whichever value is most appropriate?
Jay
>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.
>
>To demonstrate...
>
>Junk.prg
>lcString = "Testing"
>?junk1(@lcString)
>disp memo
>*Notice that lcString is now an array.
>return
>
>junk1.prg
>lParameters tuParameter
>*Push the incoming parameters
>local luParameter
>luParameter = tuParameter
>*Convert the string to an array to do some processing...
>local array laArray[1,1]
>laArray[1,1]="Something else"
>dimension tuParameter[1,1]
>=acopy(laArray,tuParameter)
>*Do the processing
>...
>*Pop the parameter (so that we get back the original string)
>tuParameter = luParameter
>return
>
>I've tried releasing tuParameter before storing luParameter to it. Any ideas?
Previous
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only