Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best approach about #DEFINE constants
Message
 
 
À
16/05/2008 12:17:20
Mike Yearwood
Toronto, Ontario, Canada
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01316940
Message ID:
01317661
Vues:
9
>Let's use your example though.
>
>?pi() is IMO the ultimate way to get PI. Except that following is inconvenient:
>
>LOCAL m.lcSetDecimals
>m.lcSetDecimals = SET("DECIMALS")
>SET DECIMALS TO 18
>?PI()
>SET DECIMALS TO &lcSetDecimals.
>
>Which is more inconvenient?
>
>PI = oApp.GetPublic("PI")
>
>That kind of call opens up more flexibility in the design. GetPublic can be standardized and overridden. It can hide the complexity of a parameter object or whatever. I don't think there's a need to have one get and set method per variable, do you?

Yes, I like this idea. You pass the name of the constant and get it back using one public method of the global object.
If it's not broken, fix it until it is.


My Blog
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform