Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Macro substitution, name expression
Message
De
24/05/2001 21:35:02
 
 
À
24/05/2001 21:05:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00511274
Message ID:
00511286
Vues:
16
Name expression --
Only works for expressions that evaluate to the name of something:
File names, tables, field names.
Significantly faster than macro substitution on those tasks.
Also properly interprets path names with embedded spaces that macro substution coughs on.

EVALUATE()
Works for expression which return a value.
Faster than macro substitution.
Recommended in most cases as a replacement for macro substitution for expressions.

Macro Substitution
Can interpret basically any VFP command, expression, or part of a command at runtime. At the heart of every command line interpreter embedded in a runtime.

In general, use only when above commands will not work for performance reasons.

Exceptions: looping structures. For example:
lcFilterExpression = " aField = 'my value'"
SCAN FOR &lcFilterExpression
    DO something
ENDSCAN

SCAN FOR EVALUATE (lcFilterExpression)
    DO something
ENDSCAN
In this scenario, the macro substitution is faster, because the substitution is performed once for the loop. The EVALUATE function is called for each record and so is significantly slower.

In addition -- for more complex runtime evaluation:
VFP 6 can compile PRGs at runtime.
VFP 7 can compile memo fields and strings at runtime.

Enjoy!

Jay
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform