Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vartype: behavior
Message
De
29/09/1998 08:07:57
 
 
À
27/09/1998 09:00:35
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00136852
Message ID:
00141848
Vues:
38
>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.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform