Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to tell if variable or field
Message
De
10/04/2008 15:36:38
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
Divers
Thread ID:
01309758
Message ID:
01309797
Vues:
6
>>>>>I don't see a problem with the object here. For me this looks like a safe code.
>>>>
>>>>
>>>>yourunknown = CREATEOBJECT([EMPTY])
>>>>? VARTYPE(m.yourunknown)
>>>>
>>>>
>>>>Just because objects are memory variables also.
>>>
>>>Right, it would be O, I think. So, what is the problem with the code above? vartype(m.unknown) = 'O', so it's not a field.
>>>
>>>vartype(unknown) <> "U" and vartype(m.unknown) = 'U'
>>>  This is a field - no exceptions except for the case of select m as an alias
>>
>>If you have no field with the name you check for, you can't tell whether you have a memvar or an object with that name. In other words, you will get the same result with an object call yourunknown, and a mevar called yourunknown.
>
>Right, but it was not the thread's question. Object is still a variable and not a field.

Exactly. I once had a teacher who introduced himself by telling us that he wanted us to always be careful to answer his questions, and not something which he did not ask. A few minutes later he asked if anybody knew what time it was, and a lot of us shouted out the correct time. Then he said "that was not the question, I only wanted to know who knows what the time is." The next day he started by asking "who has not done the homework", and most of us shouted "I have done it, teacher!". When he reminded us what he really asked, we all learnt a lesson for life.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform