Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Vartype() bug in VFP 7.0?
Message
 
 
À
04/09/2003 10:36:07
Information générale
Forum:
Visual FoxPro
Catégorie:
Problèmes
Divers
Thread ID:
00825419
Message ID:
00826490
Vues:
26
Fabio,

>If VFP put NULL, it remove limbo state and VARTYPE(ox.parent) return "X"
>without touch it's code implementation.

I don't know why parentless objects were not assigned null as the value. This goes all the way back to VFP3. It is a rare event for Microsoft to change behavior like this because to keep from breaking existing code.

TYPE( "blah.Parent" ) != O has always detected an object that doesn't have containership. So simply use it instead of trying to get vartype() to do something it's not meant to do. If youwant vartype() to work like type() you will slow it down.

>Because TYPE() not support UDF, on VFP not exist a function in order to resolve the datatype of one generic expression.

Can you give me an example of what you are talking about? ? type( sys(1) ) prints out N for me.

>Yes, i can use EVAL() within TRY...ENDTRY, but fire a error for know
>a value he is too much heavy, at least for me ( 1000x slow down ).

This is only a significant amount of time if the code is executed tens of thousands of times. If you have a situation where you'd actually have to query an object to see if it's contained that many times I'd write the code something like this:
* Init
this.lIsContained = ( type( "this.parent" ) == "O" )

* some other method called billions of times
if ( this.lIsContained )
else
endif
It really doesn't get much easier than that.
df (was a 10 time MVP)

df FoxPro website
FoxPro Wiki site online, editable knowledgebase
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform