Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
What's the secret meaning of this piece of code?
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00042899
Message ID:
00043198
Vues:
39
>> By definition, functions return a value, procedures do not. In either
>> case,
>
>Sorry to disagree, but by definition, they both return values. The only
>'real' difference between functions and procedures is the way that
>parameters are passed (by value or by reference)
>
>> they should be designed to accomplish one and only one thing (this is
>> referred to as program cohesion).
>
>However, I agree with this fully.
>
>/Paul

Paul,

I'm afraid that we'll have to agree to disagree here. Try getting a procedure to return a value in almost any other language, Pascal, C, BASIC, etc. I used the qualifier there because I'm not familiar with all languages. However, plain and simple, you can't. The procedure may modify values in the parameter list, but in and of itself a procedure does not return a value. It's true that in FoxPro the terms can be used interchangably. I personally feel that it's a bad coding practice to do so, since it detracts from the readability of the code. There's an old axiom on this, "If it ain't readable, it ain't maintainable." Since the bulk of the cost associated with any system is associated with maintenance and modification, I try to use these key words in accordance with their strict computer science definitions to help in this area.

Have I ever called a procedure as if it were a function (valid clause in FPW, for example)? Yep, but I had a quantifiable reason for doing so. In other words it wasn't an arbitrary decision on my part.

In short, what what I said to Vlad regarding the reasons that parameters to functions are passed by value, and parameters to procedures being passed by reference still applies. That's my story and I'm sticking to it.

George
George

Ubi caritas et amor, deus ibi est
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform