fbpx

Compatibility with VO: function or method

  • Wolfgang Riedmann
  • Wolfgang Riedmann's Avatar Topic Author
  • Offline
More
5 months 2 weeks ago #1 by Wolfgang Riedmann
Compatibility with VO: function or method was created by Wolfgang Riedmann
Hello,

porting one of my libraries I have come around a IMHO serious issue.
Please see the following code:
using System

function Start( ) as void
	Console.WriteLine("Hello x#!")    
	MyClass{}:MyFunc()
	return
	
function MyFunc() as string
	
	return "from static class"

class MyClass
	
method MyFunc() as string
	
	MyFunc()
	
	return MyFunc()
	
end class

If you execute this code in VO, it works as expected.
In X# it throws an stack overflow error, because the "MyFunc()" call in the method calls itself, and not the defined function.
IMHO there should be a compiler option that requires that all method calls are prefixed with self:, otherwise they should not refer to the method of the class, but search outside of the class.

Wolfgang

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

More
5 months 2 weeks ago #2 by Chris Pyrgas
Replied by Chris Pyrgas on topic Compatibility with VO: function or method
Hi Wolfgang,

Hmm, right, in VO dialect (and vulcan etc) this works as expected, but in Core it calls the method instead of the function indeed. Thanks for reporting, will log this as well.

Chris

XSharp Development Team
chris(at)xsharp.eu

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