Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to mDot Macro Expansion?
Message
De
20/10/2016 16:43:54
 
 
À
20/10/2016 16:34:15
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01642180
Message ID:
01642185
Vues:
60
>>
>>LOCAL ;
>>  lcCmd
>>
>>m.lcCmd = "m.gnTest = 1"
>>
>>&lcCmd  && Not mDotted but works as expected
>>
>>&m.lcCmd && "Unrecognized command verb"
>>
>>m.&lcCmd && Works as expected
>>
>>Is the last version the "correct" way to do this if you want the benefits of mDotting?
>
>When a macro is expanded, the interpreter always and only looks for memory variables, so the name is never ambiguous. Furthermore, during macro expansion, the dot acts as a name terminator, so issuing &m.lcCmd will try to expand a variable named "m".
>
>
>CLEAR
>
>CREATE CURSOR aCursor (m varchar(50))
>
>INSERT INTO aCursor (m) VALUES ('? "whatever"')
>
>? m
>
>LOCAL m
>LOCAL x
>
>m = '? "something"'
>x = '? m.'
>
>SELECT aCursor
>
>* expands to ? "something"
>&m.
>
>* expands to ? "something"m, and raises an error
>&m.m
>
>* expands to ? m.m 
>&x.m
>
Thanks, the first sentence of your reply was what I needed (and didn't previously know). I've tested to my satisfaction that it's true :)
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform