Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Local vs Private Parameters
Message
 
 
To
16/04/2007 14:12:50
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01216334
Message ID:
01216412
Views:
17
>>Why would you want parameters to be private?
>In this case, the parameters are used to build SQL statements which are passed to another object which does the actual data call. Since the parameters are local, I can't use "WHERE field = ?myVar" syntax since myVar is out of scope in the data retrieval object.
>
>Yes I could rewrite the receiving method to accept a parameters object. I could probably do several things differently. It just seemed to me when I posted the message that a global situation making the parameters private would be the simplest way to go and involve the smallest amount of code restructure.
>
>>I guess in most situations you would prefer to have them local, so the default behavior is correct to make the parameters local. In rare cases where you do need them private you should use PARAMETERS approach.
>
>>
>>You can also always declare private variables in the function and assign parameters to them. Extra step, of course...
>
>One of the "several things I could do differently"

Ok, I see the problem. Well, there are workarounds, just no "minimal" change as you hoped for.
If it's not broken, fix it until it is.


My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform