Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Best approach about #DEFINE constants
Message
De
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:
01317657
Vues:
11
>>Not at all. I said leaving the properties on such a public object public is no better than public variables.
>
>In other words, in order to use constants in the application you would have to do something like
>
>PI = oGlobal.GetPI()
>...
>
>Sounds inconvenient to me.
>>Not at all. I said leaving the properties on such a public object public is no better than public variables.
>
>In other words, in order to use constants in the application you would have to do something like
>
>PI = oGlobal.GetPI()
>...
>
>Sounds inconvenient to me.

Hi Naomi

mdot is "inconvenient" to some people. Tieing yourself to the building while working 12 stories up is "inconvenient" to some people. Wearing safety goggles while working with power tools is "inconvenient" to some people. ;)

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?
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform