Lew,
&memvar is NOT the same as "&memvar." The former simply replaces the &memvar
with the characters you specify in memvar and this will NOT end up being a
string as far as VFP is concerned in the code
A couple of examples:

Example 1
---------
Hello="Newval"
cStr1="Hello"

cStr2=&cStr1.  && Gives cStr2 as "Newval"
cStr2="&cStr1."  && Gives cStr2 as "Hello"


Example 2
-------------
Memvar="Select *"
&memvar. From Customer into cursor curTest
 
This simply builds theSQL expression but you could use exec() which is
quicker

=Exec(Memvar+" From Customer into cursor curTest")


Example 3
---------
Memvar="Fred"

Replace Name with "&Memvar." in Customer

This is of course the equivalent of:
Replace Name with Memvar

As a matter of course I always terminate a macro with a "." because it makes
the macro expression stand out expecially if you are accessing an object as
the Macro value: 

Memvar="oObject"

vValue=&Memvar..Property1

However It is preferable and quicker to use the Eval() in these
circumstances i.e

vValue=Eval(Memvar+".Property1")

Hope this helps

Dave Crozier
"A computer is a stupid machine with the ability to do incredibly smart
things, while computer programmers are smart people with the ability to do
incredibly stupid things. They are, in short, a perfect match"  - Bill
Bryson
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Lew Schwartz
Sent: 12 July 2006 14:27
To: profox@leafe.com
Subject: Macros format/style in old code

I'm cleaning up some old code and I keep coming across macros which are
uniformly coded with quotation marks and dots. Eg if a macro is stored in a
memvar, instead of seeing:

&memvar

The code consistently reads:

"&memvar."

All I can find out about this is that the programmer decided that using the
quotation marks and dot all the time avoided problems.

Anyone have any idea what problems are being addressed here, if any?

-Lew


[excessive quoting removed by server]

_______________________________________________
Post Messages to: ProFox@leafe.com
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to