#command is meant for translations that span a whole statement.
In this case you need #translate of #xtranslate, because VarType() will be in the middle of another line of code.
I would recommend #xtranslate because otherwise also abbreviations will be matched.
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
a question about the data types DateTime and Currency.
Both data types can be used with FP and VO. What i don´t understand are the differences i see when i toggle the dialect and check the types within a "as usual" function:
FUNCTION TestDateTimeAndCurrency() AS VOID
LOCAL dt AS DateTime
LOCAL c AS Currency
dt := DateTime(2000,12,2)
c := 12.45
// ok, the FP and VO dialect show the same results
? dt // 02.12.2020 00:00:00
? c // 12,4500
?
// ok, the FP and VO dialect show the same results
dt:GetType():ToString() // System.DateTime
c:GetType():ToString() // XSharp.__Currency
?
? "Test DateTime:"
TestUsual ( dt )
?
? "Test Currency:"
TestUsual ( c )
?
RETURN
FUNCTION TestUsual ( u AS USUAL ) AS VOID
/*
The VO dialect shows:
XSharp.__Usual
XSharp.__Usual
while the FP dialect shows:
System.DateTime
XSharp.__Currency
*/
? u:GetType():ToString()
RETURN
i hope you can follow me
btw. according the FP docs: VarType ( <DateTime> ) returns "T" and varType ( <Currency> ) "Y"
- ValType() has been fixed.
- The other difference is caused by the fact that in the VO dialect u:GetType() is early bound and in FoxPro late bound. And apparently the early bound code returns the GetType() of the usual itself and the late bound code returns the GetType() of the contents of the usual.
If you change the code to:
Then in both dialects you will get the type of the contents of the usual.
This is one of those 'Edge cases'. I am not sure what the right behavior should be here...
Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu