xsharp.eu • Compatibility with VO: function or method
Page 1 of 1

Compatibility with VO: function or method

Posted: Wed Aug 01, 2018 3:58 pm
by wriedmann
Hello,

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

Code: Select all

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

Compatibility with VO: function or method

Posted: Thu Aug 02, 2018 1:42 am
by Chris
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