SELF not available in field declaration

This forum is meant for questions and discussions about the X# language and tools
Post Reply
Kromi
Posts: 45
Joined: Wed Jan 13, 2016 8:31 am

SELF not available in field declaration

Post 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?
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

SELF not available in field declaration

Post 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
XSharp Development Team
The Netherlands
robert@xsharp.eu
Kromi
Posts: 45
Joined: Wed Jan 13, 2016 8:31 am

SELF not available in field declaration

Post by Kromi »

OK, thanks.
Post Reply