fbpx
Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: X#-Runtime problem with optional parameters (bandol 2.0.0.9)

X#-Runtime problem with optional parameters (bandol 2.0.0.9) 4 months 6 days ago #7737

  Thomas's Avatar Topic Author Thomas Offline Posts: 16
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:
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	

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
Attachments:

Please Log in or Create an account to join the conversation.

X#-Runtime problem with optional parameters (bandol 2.0.0.9) 4 months 6 days ago #7738

  Chris's Avatar Chris Away Posts: 1222
Thanks Thomas, problem confirmed, will look into it and will send you an update once it is fixed.
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

X#-Runtime problem with optional parameters (bandol 2.0.0.9) 4 months 6 days ago #7756

  Chris's Avatar Chris Away Posts: 1222
Thomas, please check your mail!
XSharp Development Team
chris(at)xsharp.eu

Please Log in or Create an account to join the conversation.

  • Page:
  • 1