PDA

View Full Version : GUID (not a real type)



Vandalf
06-03-2017, 00:19
Here's some code:

Function aba(nme As Guid)As String
Return "hello world"
End Function
Dim qqq As Guid
MsgBox 0 , aba(qqq)
Line 5 throws a runtime error: "Missing Close Parens", "Token found: ABA". That happens even if the function takes its only parameter by reference instead of by value.
If I replace every occurrence of "guid" in the code with, say, "quad", it works flawlessly.
I suppose that that is intended behavior, as per the thinBasic Help Manual on the topic of GUID (language->data types->GUID):

The GUID variable is typically used only as a parameter, rather than as a term in an expression.

However, a priori it was not obvious that the quote meant that GUID was not an accepted type for arguments. This has caused me some lossage. To prevent inflicting further lossage on any more unsuspecting users, I suggest changing the documentation to be more explicit about this issue.

ErosOlmi
06-03-2017, 07:55
Hi Vandalf,

sorry for the inconvenience.
In reality your code was supposed to work but there must be a parsing error in passing GUID data type to sub/functions.
I will have a look.

In the meantime, if you need to pass a GUID to a sub/function, please use a String parameter like the following. thinBasic will take care of internal conversions:

Function aba(nme As string) As String
Return "hello world: " & GUIDTXT$(nme)
End Function

Dim qqq As Guid = Guid$
MsgBox 0 , aba(qqq)




Thanks for reporting.
Eros