KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Naming a Constant
PRODUCT: 4D | VERSION: 6.5 | PLATFORM: Mac & Win
Published On: July 20, 2001
Your current browser may not allow you to download the asset. We recommend Mozilla Firefox or Google Chrome.
Log In

When creating a constant inside a plug-in some thought needs to be given to the name of the constant. A developer should always add a prefix that will uniquely identify a constant. If the developer does not add some unique identifier to the constant it may conflict with another plugin that is using the same name for a constant. If two different plugins have two constants with the same name, one constant will be over written by the other thereby nulling one of the values.

For example, lets say we have a plug-in we are calling 4D_ Archimedes and, inside the plug-in, we have several routines that are executing different mathematical equations that Archimedes developed. We may want to also include our own constant for Pi. When naming this constant we might want to use something like "Archimedes_Pi" instead of just "Pi". This will differentiate our constant from others.

By giving constants unique names one can eliminate possible conflicts with other constants developers may add to their own plugins.