Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to mDot Macro Expansion?
Message
From
20/10/2016 16:34:15
 
 
To
20/10/2016 16:04:16
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:
01642183
Views:
110
This message has been marked as the solution to the initial question of the thread.
>
>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
----------------------------------
António Tavares Lopes
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform