Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vartype: behavior
Message
From
29/09/1998 08:07:57
 
 
To
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:
00141848
Views:
37
>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.

The key is not to rely on VARTYPE() with an object.property if you are not sure that object.property doesn't exist. Use TYPE() for those cases. The only real case that VARTYPE() with return a "U" without a runtime error for an unknown object.property is:

x=newobject("custom")
? vartype(x.foo) && returns "U"

But in this case above, I would still use TYPE() if I was not certain property foo existed.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform