Compiler warning for missing type in declaration

This forum is meant for questions and discussions about the X# language and tools
Post Reply
George
Posts: 106
Joined: Thu Nov 05, 2015 9:17 am

Compiler warning for missing type in declaration

Post by George »

Hi,

is-there precaution (in X# compiler) to issue a warning that the variable will be USUAL when I write:

LOCAL cVariable := "something"
forgeting the 'AS TYPE' ?

regards
George
User avatar
Chris
Posts: 4902
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Compiler warning for missing type in declaration

Post by Chris »

Hi George!

The current version of the C# compiler does not support USUALs anyway, so your sample is producing an error at this line with a message "Type expected". In future builds, there will be a compiler option with which you'll be able to specify that you want to use the core version of the compiler (so still an error reported in that kind of code), the VO/Vulcan compatibility one (so no error) etc. Even in the case of using the VO compatibility flavor, I think we can also add an optional (via a compiler switch) warning on defining vars without explicitly specifying their type.

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
Chris
Posts: 4902
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Compiler warning for missing type in declaration

Post by Chris »

> The current version of the C# compiler does ...

That should read "the X# compiler" of course!!

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
George
Posts: 106
Joined: Thu Nov 05, 2015 9:17 am

Compiler warning for missing type in declaration

Post by George »

Chris,

thank you for your answer.

I just tried the X# in both XIDE and VS2015.

No problem at all with the test App in XIDE (it's a mature product), but in VS2015 a simple WinForms app created using the template, do not run the debugger because the System.Drawing isn't automatically added to the references.

regards
George
User avatar
Chris
Posts: 4902
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

Compiler warning for missing type in declaration

Post by Chris »

Hi George,

Thanks for your report. I confirm that System.Drawing.dll is not automatically added as a reference, but even so, for some reason in my machine the WinForms app template builds and runs just fine here! Not sure why this is happening, will investigate it. I guess if you manually add the reference the sample works on your machine, too, is that right?

Chris
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
George
Posts: 106
Joined: Thu Nov 05, 2015 9:17 am

Compiler warning for missing type in declaration

Post by George »

Chris,

>I guess if you manually add the reference the sample works on your machine, too, is that right?

True.

regards
George
Post Reply