Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Call a procedure like a method syntax
Message
De
24/04/2009 09:12:17
 
 
À
21/04/2009 17:33:27
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
01395833
Message ID:
01396222
Vues:
53
Matt --

This discussion has mentioned personal preferences and also speed as considerations. I'd like to add one more to the list.

I've always avoided calling by reference (except where explicitly needed), since poorly written routines can then (unintentionally and/or unknowingly) alter their calling environment.

Calling by reference is somewhat analagous to declaring a variable Private. Some called sub-routine might muck with it. I prefer to protect myself against that.

I realize of course that this can be handled by SET UDFPARMS (as to your original question about which syntax to use), so from that perspective, it's not that important. What is important is recognizing that calling by value offers some protection not offered by calling by reference.

Cheers,


>I have several procedures in a .prg file that I call in various places in my form methods. And, I have "Set Procedure to WhatEver additive" in my app startup routine.
>
>So, when I want to use one of the procedures from a form or class method, I usually do something like this:
>
>
>Do SomeProcedure with lcSomeCharString1, lcSomeCharString, llSomeBoolValue
>
>
>I like the look of my code better if I do this:
>
>
>SomeProcedure(lcSomeCharString1, lcSomeCharString, llSomeBoolValue)
>
>
>It seems to work either way, so, are there any pros or cons to one way over another?
>
>.
Jim Nelson
Newbury Park, CA
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform