xsharp.eu • SELF not available in field declaration
Page 1 of 1

SELF not available in field declaration

Posted: Wed Aug 22, 2018 7:54 am
by Kromi
Hi,

the following construct compiled and worked in Vulcan.NET:

Code: Select all

CLASS GapCockpitShellWindow INHERIT GapShellWindow IMPLEMENTS IGapCockpitShellWindow
        PRIVATE activatedEventHandler := EventHandler{SELF, @ActivatedShell()} AS EventHandler
The X# compiler gives me an error:
Error XS0027 Keyword 'SELF' is not available in the current context

Is this intended?

SELF not available in field declaration

Posted: Wed Aug 22, 2018 8:26 am
by robert
Mathias,
This is a side effect from the fact that we have used Roslyn as compiler engine. C# also does now allow you to use "this" in places like this.
You should have no problem if you move the initialization of the event handler to the constructor of the class.

Robert

SELF not available in field declaration

Posted: Wed Aug 22, 2018 8:33 am
by Kromi
OK, thanks.