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

TOPIC: Compatibility with VO: function or method

Compatibility with VO: function or method 7 months 3 weeks ago #1

  • wriedmann
  • wriedmann's Avatar Topic Author
  • Away
  • Posts: 1423
  • Karma: 6
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
Wolfgang Riedmann
Meran, South Tyrol, Italy
This email address is being protected from spambots. You need JavaScript enabled to view it.
www.riedmann.it - docs.xsharp.it

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

Compatibility with VO: function or method 7 months 3 weeks ago #2

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.

  • Page:
  • 1