Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to mDot Macro Expansion?
Message
From
20/10/2016 16:43:54
 
 
To
20/10/2016 16:34:15
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows 7
Network:
Windows Server 2012 R2
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01642180
Message ID:
01642185
Views:
59
>>
>>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform