Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Returning an Array from a Function
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00338850
Message ID:
00339890
Vues:
23
>>The point here is that I didn't know Nigel was speaking of objects; I replied to his message thinking he was speaking of variables. Anyways, not too important.
>>
>>To say "you pass an object by reference" means the same thing as "you pass an object reference" as far as I'm concerned.
>>
>
>There is a huge difference, regardless of your interpretation; pass by reference indicates that the function/method receiving the parameter receives the address of the parameter, as opposed to pass by value, in which case the function/method receives the address of a copy of the value of the parameter.

"As opposed to pass by value"?? When did I say "pass by value" in my message?? I'll repeat the statement:
To say "you pass an object by reference" means the same thing as "you pass an object reference" as far as I'm concerned.

"you pass an object by reference" - to pass a memory pointer
"you pass an object reference" - to pass a memory pointer

Are you adding the words "by value" to the end of the second statement? That would change the statement and the meaning.

>>As far as creating and then destoying an object in the calling routine, that is not really passing the object. That is just creating something that will be in scope in the called function. But your meaning is understood.
>>
>
>I don't think you do. There are languages that permit you to pass an object by value; this means that the receiving function/method gets the address of a copy of the object, as opposed to the address of the copy of an object pointer value. The object passed by value in this case would have a lifespan of the parameter's validity, as opposed to an object reference passed by value as is the case with VFP pass by value, as opposed to the address of the object pointer, the case of VFP's pass by reference. And you absolutely need to understand this difference, since it's an important concept for little unimportant issues like COM!

Ed, that is a very unclear way of explaining something. Normally, showing different cases and the details of that case would be more effective. Regardless, why even talk about passing by value when it isn't done in VFP with objects? You either pass a pointer, or a pointer to a pointer. Right?

Anyways, this is not the original point. You said "To actually pass an object by value, you'd have to create a copy of the object in the calling code and destroy the created object copy on return." If you are creating the copy and then working with that copy, you are not really passing by value. You are passing by reference to the COPY. So sure, you can manipulate and change the COPY without changing the original object. But you are only simulating passing the original by value, you are not actually doing it. But your meaning is understood.
Joseph C. Kempel
Systems Analyst/Programmer
JNC
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform