Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
TYPE a Parameter as Reference
Message
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00730040
Message ID:
00730259
Views:
21
Bret,

There's nothing to disagree about. We are talking about two different cases here. My explanation was about VFP function, yours is about COM object (class) method. So both of them are correct.

>>Bret,
>>
>>The 'AS' clause is used by IntelliSense only and is ignored by VFP compiler. Regardless what type you put there, a function will accept any type of parameter. VFP doesn't distinguish between input and output parameters. You can assign value to any parameter inside function. However calling program would see changes only in the parameters passed by reference.
>>
>
>Sergey I am going to have to disagree here. I am building a COM to be used by applications other than VFP and other than MS products. So in order to ensure that what I build follows a described COM model that other Non-MS applications expect, then I need to ensure I do rigid TYPING of all my Methods and Parameters that are exposed to the Non-MS App. I will give you an example. I am testing COMCodeBook with Cold Fusion MX. Now some of the calls seem to work, but those that will not consistantly work at all are the Method calls where a parameter is needed and no Typeing was done to the Parameter. Once I edited the COMCodeBook base and ensure that the exposed method calls with parameters were type correctly, then Cold Fusion recognized them and executed them correctly. The latest problem occurred when COMCodeBook needed a parameter that is passed by Reference or What Cold Fusion refers to as an In/Out parameter. I adjusted the COMCodeBook to use:
>
>FUNCTION Save( rxMsgSvc AS String) AS Integer
>
>Which works great in FoxPro, but still did not return any value to rxMsgSvc even though I was following Cold Fusion's sytax for passing a parameter by Reference. Then I got to thinking that FoxPro is not declaring that Parameter as passed by reference, thus Cold Fusion (who is following a prescribed COM Model) does not recognize it for what it is. So after digging in the VFP 7 help file I found the following syntax:
>
>FUNCTION Save( rxMsgSvc AS String@) AS Integer
>
>The @ will declared that the Parameter is one that is passed by reference. Thus Cold Fusion is now reading it correctly and passing back the value as expected when Cold Fusion passes in a Parameter by reference.
>
>So the bottom line is that TYPING does matter. It may not matter to VFP, but is does matter to other Non-MS applications that rely on what a COM Model should be. And I think most of us would like to write COM object that can be used by as many applications are we can. VFP 7 gives us this capability and we should ensure we use it just to get in the practice.
>
>
>
>>>I was wondering what you would TYPE a parameter as that is passed by reference into a Method. So if the method expects a string passed by reference to a method that would return an integer. What would be the syntax of the parameter typeing that would identify it as an In/Out Type parameter?
>>>
>>>
>>>  FUNCTION Save( rxMsgSvc AS ?) AS Integer
>>>
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform