X#-Runtime problem with optional parameters (bandol 2.0.0.9)
Posted: Thu Mar 14, 2019 5:31 pm
Hi All,
X# version 2.0.0.9
Dialect Vulcan.NET
There seems to be a problem with optional parameters in the X#-Runtime. The value for an optional parameter is not set if you call a method from an untyped object.
Example:
With X#-Runtime the optional parameter 'optParam' is null when called from function TestDefault(). 'optParam' is an empty string if called from function TestDefaultCorrect(). With Vulcan-Runtime this works as excepcted, both calls result in 'optParam' as empty string.
You will also find attached a simple console exe to reproduce this.
Regards
Thomas
X# version 2.0.0.9
Dialect Vulcan.NET
There seems to be a problem with optional parameters in the X#-Runtime. The value for an optional parameter is not set if you call a method from an untyped object.
Example:
Code: Select all
BEGIN NAMESPACE XSharpTests
FUNCTION Start() AS VOID STRICT
TestDefault()
TestDefaultCorrect()
FUNCTION TestDefault() AS VOID STRICT
LOCAL oTest := Test{}
oTest:TestMethod("Test") // wrong - 'optParam' is null
FUNCTION TestDefaultCorrect() AS VOID STRICT
LOCAL oTest := Test{} AS Test
oTest:TestMethod("Test") // ok - 'optParam' is empty string
CLASS Test
PUBLIC METHOD TestMethod(param AS STRING, optParam := "" AS STRING) AS LOGIC
IF optParam == ""
return .T.
ELSE
return .F.
ENDIF
END CLASS
END NAMESPACE
You will also find attached a simple console exe to reproduce this.
Regards
Thomas