Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I doubt this one is by design
Message
 
 
À
09/09/1999 12:38:10
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00262975
Message ID:
00263038
Vues:
17
I see your point and duplicate this error. The lesson [work-around] is to set a llRetVal within the With/Endwith, then do a RETURN llRETVAL after the EndWith.

This is now bothering me because I probably have some code somewhere that will do this same thing. I commented out the 2nd class definition, and I still got .T. returned from RunTest. :(

>Consider the following class definitions:
>
>
>DEFINE CLASS Tester AS Custom
>	PROCEDURE RunTest
>		LOCAL oDummy
>
>		oDummy = CREATEOBJECT("wwIPSTuff")
>		WITH oDummy
>			RETURN .F.
>		ENDWITH
>	ENDPROC
>ENDDEFINE
>
>DEFINE CLASS Dummy AS Custom
>	PROCEDURE Destroy
>		x = 1
>	ENDPROC
>ENDDEFINE
>
>
>Now test with the following-
>otester = CREATEOBJECT("tester")
>?oTester.RunTest()
>
>Even though Runtest explicitly returns .F., the results of the function are .T.. this took me a long time to narrow down, but I found that the code that makes the difference is the WITH/ENDWITH.
>
>Apparently, when a local object is referenced with a WITH/ENDWITH, and the routine exits, the code in the destroy method of the referenced object "erases" the ruturn value of the routine, replacing it with the default, .T..
>
>To reproduce this 3 things have to be true:
>You have to create an object that is referenced only with a local or private varibale,
>That object must be referenced internally by VFP when the routine finishes, thereby releasing the variable and the object AND the object must have code in its Destroy event.
>
>I wanted to get some input here before submitting this as a bug.
Mark McCasland
Midlothian, TX USA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform