Leonid,
1) If you want to use structures in X# for procedural programming I advise to use the normal .Net structures and not VOSTRUCT. You can use all data types that you want in normal structures. So you could change them from the VOSTRUCT syntax to STRUCTURE if you want. Of course you would have to change MEMBER to PUBLIC and add an END STRUCTURE at the end.
The biggest difference is that VOSTRUCT is assumed to be a reference type. So AS <somevostruct> is actually a reference to a VOSTRUCT, where for STRUCTURE AS <somestruct> declares the structure.
For VOSTRUCT we have added the IS syntax to declare a structure on the stack, just like in VO.
Of course you can also use REF <Somestruct> or AS <SomeStruct> PTR to have a reference to a .Net structure.
If you use reflector to look at the generated IL for the VOSTRUCT type you will see that we are automatically converting
to
Code: Select all
LOCAL oStruct AS <SomeVoStruct> PTR
and
to
2) To pass data around like what you describe you can easily use classes in .Net. There is very little overhead. And if you are only passing around 2 or 3 values you can use a .Net structure (see 1). Of course these will be passed by value, unless you explicitely pass them by reference your self.
3) In X# a symbol is still a DWORD, just like in VO. The DWORD is the index into a (global) table where the String that represents the symbol is stored. You can (explicitely) cast the Symbol to a DWORD and back to without problems. If course casting a "random" DWORD to a Symbol could result in an error if the value of the DWORD exceeds the length of the table with strings.
In fact we check for that and will return NULL_SYMBOL for invalid DWORD values.
See
https://github.com/X-Sharp/XSharpPublic ... Symbol.prg for the code of the Symbol type (which is a .net structure by the way). The type has one value:
There is an explicit converter from DWORD to SYMBOL and BACK:
Code: Select all
STATIC OPERATOR EXPLICIT(dwValue AS DWORD) AS SYMBOL
STATIC OPERATOR EXPLICIT(symValue AS SYMBOL) AS DWORD
And yes there are also (implicit) converters from Symbol to String and back. I don't like these, but these were introduced in Vulcan so we had to add them as well.
Robert