_Val() function xsharp.core

This forum is meant for questions and discussions about the X# language and tools
info@task.si
Posts: 31
Joined: Mon Nov 02, 2015 2:08 pm

_Val() function xsharp.core

Post by info@task.si »

Hi all !
Env. Xsharp 2.7 public
As I understand _Val(string) Function returns obj. In Core dialect there is no truncate function (like ConvertToInt32() in C#).
So, to convert string to usual and later to integer. we must use Val() function from XSharp.RT.
My question are:
a) Is there anything undocumented in Core.dll ?
b) What is impact of using two (or more) X# dll on final executable. Is final code "overweighted". My question explicitly adresses problem that till this moment a Val() function is the only funct. that I need it from XSharp.RT.dll ?
TIA Andrej
User avatar
Chris
Posts: 4922
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

_Val() function xsharp.core

Post by Chris »

Hi Andrej,

Everything defined in the framework that you can use in c# can also be used by X#. This works fine:

? Convert.ToInt32("123")

same with other similar parsing methods like Int32.Parse(), System.Double.Parse() etc.

So you can simply use those, instead of the _Val() function, which was designed to translate numeric data from dbf fields, and also supports the special quirks Visual Objects has in this area of conversions, which is something I guess you do not need.

So no reason for you to use the runtime dlls, but to answer your question, if the dialect you have selected for your project is "Core", then simply referencing the runtime dlls does not have an impact on your executable. In fact, the dlls are not even loaded at runtime in memory at all, until you actually do use something (like a function) from those dlls.
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
info@task.si
Posts: 31
Joined: Mon Nov 02, 2015 2:08 pm

_Val() function xsharp.core

Post by info@task.si »

Hi and thank you Chris !

I can't find Convert.ToInt32(string) in the XSharp Runtime Documentation !
Using Convert.ToInt32(string) in my program I get XS0029 error :
error XS0029: Cannot implicitly convert type 'int' to 'string' 524,5 Start.prg SysKey:.ctor

note: SysKey is my class where I read data from my MSSql Table using DataAdapter
What is missed ?

I understand your answer about loading dll. My problem is that I use X# as a project in my VS 2019 Blazor solution. When the solution is compiling I can see that both Xsharp libraries are "touched". So it worries me a little if everything will be OK (in real world or in different OS).
Andrej
User avatar
wriedmann
Posts: 3756
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

_Val() function xsharp.core

Post by wriedmann »

Hi Andrej,
of course this method is not documented in the X# documentation as it is a method of the .NET Framework.
You should look in the Microsoft documentation for it.
You will need to include the "System" library in your application.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
User avatar
Chris
Posts: 4922
Joined: Thu Oct 08, 2015 7:48 am
Location: Greece

_Val() function xsharp.core

Post by Chris »

Hi Andrej,

This error message does not seem to be related to Convert.ToInt32() itself, but some other part of the code. What is the exact line of code for which the compiler reports this error?

Regarding the libraries, what do you mean with "touched"?
Chris Pyrgas

XSharp Development Team
chris(at)xsharp.eu
info@task.si
Posts: 31
Joined: Mon Nov 02, 2015 2:08 pm

_Val() function xsharp.core

Post by info@task.si »

Thank you Wolfgang and Chris !
Documentation: .NET (now I understand)
using Convert.ToInt32 --> no errors more; mistake in my variable declaration

Chris: During compilation in VS in the footer line you may notize different phases, stages of compilation. And off course because XSharp project (source code) is a part of a final solution , I can see also XSharp.Core dll for a moment that is "touched".

TIA Andrej
User avatar
wriedmann
Posts: 3756
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

_Val() function xsharp.core

Post by wriedmann »

Hi Andrej,
I have many projects in X# that don't use X# runtime DLLs at all - partly their were written before the X# runtime was ready.
Therefore they don't use any X# DLL, and only .NET Framework functionality.
it is like working with C# but using my favorite language - clear and easy to understand, without counting of parentheses and semicolons.
Most of them are WPF applications, some Windows services or console programs and some Windows Forms applications.
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
info@task.si
Posts: 31
Joined: Mon Nov 02, 2015 2:08 pm

_Val() function xsharp.core

Post by info@task.si »

Hi Wolfgang !
Thank you for this information. Till now I was not thinking in this way at all (without X# dll).
As you probably notize I am a "half year" newbie in all technologies (Blazor, C#, HTML, CSS, X#, .NET, web) so it very difficult to understand all things.
Did you try anything in Blazor ? I can show you and to others my first real app written in this new MS tool. Off course aprox. 40 % of code is in X#. X# and Blazor just opened me a total new world.

Andrej
User avatar
wriedmann
Posts: 3756
Joined: Mon Nov 02, 2015 5:07 pm
Location: Italy

_Val() function xsharp.core

Post by wriedmann »

Hi Andrej,
X# is basically a C# compiler that understands X# syntax and has many additions to make VO/VFP/XB++ also compile.
The Core dialect does not knows the Xbase datatypes, and it was the first available dialect (I had the first small application in production after about a year of the first compiler release).
Regarding Blazor: unfortunately I'm more than busy with my desktop applications, both in X# and in VO, and therefore I have no time for web applications. This is the area of my wife and another programmer in my company - they do all the web work with PHP, MySQL and PostgreSQL (and of course all the CSS and Javascript that is needed).
Wolfgang
Wolfgang Riedmann
Meran, South Tyrol, Italy
wolfgang@riedmann.it
https://www.riedmann.it - https://docs.xsharp.it
Frank Müßner
Posts: 280
Joined: Sat Dec 12, 2015 2:22 pm
Location: Germany

_Val() function xsharp.core

Post by Frank Müßner »

Hi Andrej,

i would like to see the Blazor code. i Try to create a web program with Blazor/X#. :-)

Regards Frank
Post Reply