xsharp.eu • VOScript
Page 1 of 1

VOScript

Posted: Thu Feb 27, 2020 7:32 am
by ecos
Hi,
in our VO-Application we have implemented the library VOSCRIPT and we use scripting a lot in order to adjust the behaviour of the programm according to the wishes of our customers. Porting the source of VOSCRIPT to x# is essential for us. In a first test there seems to be only one big problem. Scripting variables are created via

local cVarname as string
local uValue as usual

cVarname := .....
uValue := ...

PRIVATE &cVarname
&cVarname := uValue

x# doesn't accept this code. Is there any chance to make this possible or is there a smarter workaround ?
memvarput() does not show the same result as the original code.

TIA
Karl

VOScript

Posted: Thu Feb 27, 2020 8:27 am
by Chris
Hi Karl,

Hmm, good point, I think this was just overlooked. I think it can be implemented, but not totally sure. We will have a look into this and will get back to you in a few days.

VOScript

Posted: Thu Feb 27, 2020 8:38 am
by wriedmann
Hi Chris,
VOScript was used by a lot of people - and it was distributed with VO 2.6.
I have a regular (paid) & source code license of it, and I had tried to contact the author a few years ago, but wasn't able to reach him.
Wolfgang

VOScript

Posted: Thu Feb 27, 2020 11:34 am
by Chris
Guys,

The functionality already exists, but not the syntax for handling memvars with the & syntax. This works already just fine:

Code: Select all

FUNCTION Start() AS VOID
LOCAL cVarname AS USUAL
cVarname := "myprivate"

// Declare private:
__MemVardecl(cVarname , TRUE)

// Assign value
__MemVarPut(cVarname , "abc")

// Read value
? __MemVarGet(cVarname)

// this also works of course
? myprivate

so theoretically all the code can be modified above and it should work fine in X# as well. But I *think* it will be possible to support the original syntax as well, so no code changes will be necessary.

VOScript

Posted: Thu Feb 27, 2020 12:32 pm
by ecos
Hi Chris,
this seems to work in x#.
As this affects only about 10 lines of code in VOSCRIPT the old syntax is not so important.
In normal coding I will never use PRIVATES

Thanks
Karl

VOScript

Posted: Thu Feb 27, 2020 5:22 pm
by Chris
Hi Karl,

Ah, so it's should be easy! In that case maybe you could also rewrite this small piece of code so that it uses something different than PRIVATEs, something like a Dictionary maybe for holding the values. It is not necessary, would probably just make the code faster and easier to read.

VOScript

Posted: Thu Feb 27, 2020 6:34 pm
by Karl-Heinz
Guys,

in the last months i posted a lot memvar samples. I "love" memvars - why struggle with tons of typed locals if the job can be done with two or three privates/publics instead ? Ok, just kidding :-)

regards
Karl-Heinz

VOScript

Posted: Thu Feb 27, 2020 6:42 pm
by wriedmann
Hi Karl-Heinz,
I'm using memvars also a lot, but never in "normal" code, but in dynamic code, mostly in my report engine where I use MemVarPut() a lot (to set report variables).
Wolfgang

VOScript

Posted: Thu Feb 27, 2020 7:51 pm
by Karl-Heinz
Hi Wolfgang,

in "normal" VO code memvars are a no go. To be honest, in the past 25 VO years i never had the need to use privates/publics. Of course, for our VFP friends, or if you are using scripting memvars are a must.

regards
Karl-Heinz