Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
To fix or not to fix, that is the question
Message
De
13/07/2006 03:53:45
 
 
À
11/07/2006 09:53:25
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 6
OS:
Windows XP SP2
Divers
Thread ID:
01135306
Message ID:
01135940
Vues:
12
>Hi all
>
>I've got a situation. Inherited code, BTW. A formset - which seems really superfluous in this case, has a form. The form dimensions an array in the load. That's a private array, almost public.
>
>DIMENSION SomeArray[10]
>
>A button on the form calls a PRG which contains the line:
>
>EXTERNAL ARRAY SomeArray
>
>The array is not passed to the PRG as a parameter.
>
>The PRG calls a UDF, passing the array like this.
>
>DO UDF WITH SomeArray
>
>The programmer attempted to receive the array in a UDF.
>PARAMETERS SomeArray
>

try
PARAMETERS SomeArrayNewName

or

LPARAMETER SomeArrayNewName
>Technically, the array wasn't passed, just the first element's value.

Not true. A reference is passed.

>
>Subsequent references prove that the array is virtually public. The name is consistent throughout the set of code.
>
>x=SomeArray[5]
>
>DISPLAY MEMO shows SomeArray as Hidden in the UDF,
>

This because a variable passed by reference it is hidden, and with tha same name VFP can fail the display memo ( not checked ).

>It's confusing but it works. I could dispense with passing and receiving the array, which would make it clearer, or re-engineer it to make it properly encapsulated, which means changing the UDFs.
>
>Or just document the existing situation.
>
>What would you do?

Forgot DO, and uses func(@variable)
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform