Type( <cMacroExpr> ) --> UI

45 views
Skip to first unread message

wanst...@gmail.com

unread,
Jan 13, 2026, 3:49:36 PM (11 hours ago) Jan 13
to Harbour Users
Hi, maybe it was already discussed here but I couldn't find it.

I am just trying to understand why these examples give different results:


? Type( 'str(1,5,2)' )       // C

? Type( 'strzero(1,5,2)' )   // UI


I just don't understand why...

lai...@paysoft.com.br

unread,
Jan 13, 2026, 8:52:44 PM (6 hours ago) Jan 13
to Harbour Users
It look like strzero just check runtime. 

An alterinative is:

? ValType( &( 'strzero(1,5,2)' ) )


Mario

unread,
Jan 13, 2026, 10:55:11 PM (4 hours ago) Jan 13
to harbou...@googlegroups.com
Hi Laiton,

Yes, it could be an alternative for certain situations but I was considering the use of Type() to determine the data type of a macro expression containing function calls by evaluating or executing it with the macro operator.
According to the documentation I found in my research, such functionality is restricted, however, to basic functions built into Harbour which operate on simple data types.
If the macro expression contains calls to complex functions or user-defined functions, Type() does not evaluate the macro expression and, thus, cannot determine the data type as in my example with StrZero().
My goal was to create a check for database related expressions to avoid any possible errors by the user input so Type() was a pretty good candidate and I will keep studying it and Valtype in combination with the & macro operator


--
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: https://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to a topic in the Google Groups "Harbour Users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/harbour-users/MC_CuDEo7hk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to harbour-user...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/harbour-users/f2a32945-a551-426f-ab77-22e2fa0410d5n%40googlegroups.com.

lai...@paysoft.com.br

unread,
Jan 13, 2026, 11:35:23 PM (3 hours ago) Jan 13
to Harbour Users
Got it :D
Good lucky
Reply all
Reply to author
Forward
0 new messages