X# 2.6: XS0218

This forum is meant for questions and discussions about the X# language and tools
Post Reply
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# 2.6: XS0218

Post by wriedmann »

Hi Chris,
with 2.6 I have a very compile strange error:

Code: Select all

error XS0218: In order for 'XSharp.__Usual.operator &(XSharp.__Usual, XSharp.__Usual)' to be applicable as a short circuit operator, its declaring type 'USUAL' must define operator true and operator false
in this line of code:

Code: Select all

while ! oHallo:EoF .and. oHallo:FieldGet( "what" ) == ""
This is the complete sample code:

Code: Select all

function Start( ) as void
	local oHallo		as DbServer

	System.Console.WriteLine("Hello x#!")

	oHallo := DbServer{ "c:temphallo.dbf" }
	oHallo:GoTop()
	while ! oHallo:EoF .and. oHallo:FieldGet( "what" ) == ""
		oHallo:Skip()
	end
	oHallo:Close()

	return
if I change the code to

Code: Select all

while oHallo:EoF == false .and. oHallo:FieldGet( "what" ) == ""
it compiles.
I have a lot of similar code in my applications....
Please find a complete sample attached.
Wolfgang
DbServerEof.zip
(1.23 KiB) Downloaded 66 times
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

X# 2.6: XS0218

Post by Chris »

Hi Wolfgang,

Thanks, I see the problem, but in this sample you are using USUALs inside a Core app, which is not really a supported scenario. Is there any reason why you use Core dialect instead of VO in this case?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# 2.6: XS0218

Post by wriedmann »

Hi Chris,
no, this is was not intended.....
The code comes from a real application, and since I'm using the Core dialect whenever possible to have better code, and sometimes I need to use DbServers there.... and DbServers are returning usuals.
I have to return to my project of a fully typed DBServer.... Unfortunately I'm having some problems with my CoreDBF based on the RDD (don't have found out yet how to set orders).
Sorry for the false alarm!
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4907
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

X# 2.6: XS0218

Post by Chris »

Hi Wolfgang,

Ah OK, thanks, glad it is not really a problem!

Btw, I wouldn't say that code in Core dialect is "better" than in VO or other dialects, it's just different regarding things like character literals, string literals etc. In fact the only reason I do not always use the VO dialect in all my apps (including XIDE), is that it requires references to the X# runtime.

Btw, if what you are after is making sure you do not have accidentally left untyped locals, parameters etc, you can simply add this in the extra options of your apps:

/vo15-

this will tell the compiler to always check for that, even in VO dialect.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# 2.6: XS0218

Post by wriedmann »

Hi Chris,
thank you very much!
After seeing all the trouble untyped variables can cause in the compiler and/or the runtime I would prefer to exclude that whenever possible and create code that is clear not only to me, but also to the compiler and the runtime.
For legacy code all the compiler and runtime sorcery is needed, but in newly written code it should not be necessary (therefore I'm using ADO to access ADS).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
robert
Posts: 4520
Joined: Fri Aug 21, 2015 10:57 am
Location: Netherlands

X# 2.6: XS0218

Post by robert »

Wolfgang, Chris,

We can also consider to add an operator TRUE and operator FALSE to the Usual type.
This should not hurt, I think.

Robert
XSharp Development Team
The Netherlands
robert@xsharp.eu
User avatar
wriedmann
Posts: 3755
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

X# 2.6: XS0218

Post by wriedmann »

Hi Robert,
that would be great, thank you very much!
Personally I think that usuals in Core dialect code will occur.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Post Reply