Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
I doubt this one is by design
Message
De
09/09/1999 12:38:10
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Titre:
I doubt this one is by design
Divers
Thread ID:
00262975
Message ID:
00262975
Vues:
53
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.
Erik Moore
Clientelligence
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform