Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
RETURN does arrays!
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00570900
Message ID:
00571127
Vues:
25
George,

>>>>I didn't notice this in the "New....." section or the "Enhancements..." section of the VFP7 documentation, nor does the RETURN Command write-up mention it, so I thought I'd mention it here as it seems quite important to me.
>>>>
>>>>An array can be specified as eExpression of a RETURN command provided that:
>>>>1) the array was passed by reference into the function in the first place;
>>>>2) the array is still in scope when the RETURN executes.
>>>>
>>>>Found this reading "What's New in Visual FoxPro 7.0" from Hentzenwerkes.
>>>
>>>Yes, it does work, but probably not like most folks would like. Try the following:
FUNCTION ArrayTest
>>>  LPARAMETER ta_foo
>>>
>>>  EXTERNAL ARRAY ta_foo
>>>  DIMENSION ta_foo[2]
>>>  ta_foo[1] = "A"
>>>  ta_foo[2] = "B"
>>>  RETURN ta_foo
>>>ENDFUNC
>>>
>>>DIMENSION a_foo[1]
>>>a_foo = NULL
>>>a_foo = ArrayTest(@a_foo)
>>>DISPLAY MEMORY LIKE a_foo
You'll see that the array is re-dimensioned but the values in both elements are the same. I also tried this with numbers.
>>
>>It only works when the array is a property of an object. The RETURN in this case is retuning the first element.
>
>I guess that the array being re-dimension is caused by passing by reference. Funny thing is that I haven't seen anything in the docs about this. The enhancement section doesn't even include RETURN. Guess I'll have to play with an object and see what's up there. Your explanation, does make sense, BTW.

THAT was the point of my writing this thread. And equally importantly is that if there are "quirks" to the way it processes 'depending on' then these need to be spelled out too.

Jim
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform