Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vartype: behavior
Message
From
27/09/1998 09:00:35
Dragan Nedeljkovich (Online)
Now officially retired
Zrenjanin, Serbia
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00136852
Message ID:
00141209
Views:
37
>Now, here is the confusion. In order to increase the value (common usage) of VARTYPE() vs. TYPE() since VARTYPE() is much faster and returns "X" for NULL values, VARTYPE() has a "special" ability unlike other VFP functions and that is if a variable (not an expression or object.propery) is passed to it that doesn't exist, it would return "U" instead of causing a runtime error. This is considered a feature, and I'm certain that most developers like this enhancement to VARTYPE(). I think the confusion here is that this special behavior is misleading developers into thinking it can return "U" for any invalid expression, but that's not the design. You need to use TYPE() for expressions that may cause a runtime error. Hope this helps clarify this issue.

How are we supposed to know what is treated as a variable, and what constitutes an expression? The cases where some arithmetic is involved are obvious, but when is VarType() treating object.property, object.member and object.member.property as an expression, and when as a variable? There must be a general rule to this. I'll simply add it to my Brain.Fox.Map and use it further on.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform