xsharp.eu • Transporting VO to XSharp - Page 2
Page 2 of 2

Transporting VO to XSharp

Posted: Fri Apr 17, 2020 2:59 pm
by Chris
HI Leonid,

Now that you mention it, I remember we discussed this in our dev meeting. But I do not remember what we decided about it :). Will let Robert remind us..

Transporting VO to XSharp

Posted: Fri Apr 17, 2020 3:28 pm
by robert
Leonid,
For out parameters we definitely support the "discard" variable that is just an underscore.
I am not sure , but I think we support that for REF parameters as well.
Just give it a try.

Robert

Transporting VO to XSharp

Posted: Fri Apr 17, 2020 3:56 pm
by leon-ts
Robert,

Could you give an example of the syntax of this in XSharp? I could not do it even for OUT. The compiler throws an error:
XS0103 The name '_' does not exist in the current context
I tried several options:

Code: Select all

MyFunc(1, 2, OUT _)
MyFunc(1, 2, OUT STRING _)
MyFunc(1, 2, _)
MyFunc(1, 2, @_)
Best regards,
Leonid

Transporting VO to XSharp

Posted: Fri Apr 17, 2020 4:00 pm
by robert
Leonid.

MyFunc (1, 2, OUT VAR _ )
MyFunc (1, 2, OUT _ AS STRING)
MyFunc (1, 2, OUT NULL)

// not sure about the following ones
LOCAL _ as STRING
MyFunc (1, 2, REF _ )


See https://github.com/X-Sharp/XSharpDev/bl ... rp.g4#L839 for the formal declaration of different syntaxes

Robert

Robert

Transporting VO to XSharp

Posted: Fri Apr 17, 2020 4:14 pm
by leon-ts
Robert, thanks!
All examples with OUT work fine. REF, as you have shown, also works fine (without warning of an unused variable). If REF still worked with underscore in the same syntax as OUT (without a LOCAL declaration), it would be very fine :)

Best regards,
Leonid

Transporting VO to XSharp

Posted: Fri Apr 17, 2020 5:40 pm
by robert
Leonid
Can you open an issue for this on GitHub so I won’t forget this?

Robert

Transporting VO to XSharp

Posted: Fri Apr 17, 2020 7:06 pm
by Chris
Since Leonid does not have a Git account, I opened it myself: https://github.com/X-Sharp/XSharpPublic/issues/363

Transporting VO to XSharp

Posted: Mon Apr 20, 2020 7:42 am
by leon-ts
Hi all!
Happy Easter (Orthodox)!

Some details were clarified, considering which, perhaps, there is no need to do underscore for "REF".
It turns out that in the VODBOrdSetFocus function, the "cOrder" parameter, which returns the previous value, is declared as "OUT".

Code: Select all

XSharp VoDbFunctions.prg
FUNCTION VoDbOrdSetFocus(cIndexFile AS STRING,uOrder AS USUAL,cOrder OUT STRING) AS LOGIC
    RETURN VoDb.OrdSetFocus(cIndexFile,  uOrder, OUT cOrder)
But in the VS 2019 editor, it appears as "REF" (see screenshot in the attachment). This is what confused me. But since this is actually "OUT", where underscore works great, I don’t see the need to modify "REF". Better to improve integration with VS 2019 :)

Best regards,
Leonid

Transporting VO to XSharp

Posted: Mon Apr 20, 2020 9:05 am
by robert
Leonid,

Confirmed and fixed. I also noticed that the XML comments were not shown for methods/functions with REF or OUT parameters. This has been fixed too.

Robert