Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best approach about #DEFINE constants
Message
 
 
To
16/05/2008 12:17:20
Mike Yearwood
Toronto, Ontario, Canada
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01316940
Message ID:
01317661
Views:
8
>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
Previous
Reply
Map
View

Click here to load this message in the networking platform