Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How 'm.' is handled by Clipper
Message
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
How 'm.' is handled by Clipper
Divers
Thread ID:
00970884
Message ID:
00970884
Vues:
73
Clipper was once a bright star in the xBase world until Nantucket was bought by CA. I believe a number of members of this forum, who have ever programmed in the dBASE era, had been deeply impressed by the innovative enhancements (over 15 years ago) by Nantucket to the xBase language including:
  • Introducing classes and objects to xBase programming
  • User-defined commands
  • A powerful command pre-processor (much more powerful than the latest version of VFP)
and much more.

The way Clipper handles the conflict between identical variable names and fields names is worth knowing and can be a reference for the VFPT for future language enhancement. There are 2 keywords which help the compiler to clarify the target of the names:
MEMVAR ListOfVariableNames
FIELD ListOfFieldNames [IN Alias]
Unaliased references to the names specified by MEMVAR will be assumed to be variables. Similarly, unaliased names specified by FIELD will be assumed to be fields.

The declarations can be overridden by explicit alias assignments such as
FIELD->Amount 		(or Customer->Amount)
MEMVAR->Amount		(or M->Amount)
If a similar enhancement is introduced to VFP, most of the time "m." will no longer be needed and accurate references can still be achieved. For example, the following lines are a variation of Clipper's implementation for declaring names which will be default to memory variable rather than field names in subsequent code:
MEMVAR LOCAL VariableList	(or a short form: MLOCAL VariableList)
MEMVAR PRIVATE VariableList	(or a short form: MPRIVATE VariableList)
Of course, our existing declaration syntax will work without any change (giving precedence to fields):
LOCAL VariableList
PRIVATE VariableList
Similarly, we may declare parameters using one of the following statements:
MEMVAR LPARAMETERS VariableList	(or a short form: MLPARAMETERS VariableList)
MEMVAR PARAMETERS VariableList	(or a short form: MPARAMETERS VariableList)
LPARAMETERS VariableList
PARAMETERS VariableList
Ben
Répondre
Fil
Voir

Click here to load this message in the networking platform