Hmm... My original post wasn't quite right, sorry. It's not a question
of alternative macros; it's a question of unnecessary ones.  I'm seeing
this in stuff that looks like:

cMemvar = "bob"

Select ...
>From ....
Where person = "&cMemvar."
.... 

Is there any point to this at all?

I'll post others as I find them.

Also, for what it's worth, I don't find exec() faster for one line
macros at all. A simple & wins hands down.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Dave Crozier
Sent: Wednesday, July 12, 2006 10:05 AM
To: [EMAIL PROTECTED]
Subject: RE: Macros format/style in old code

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: [email protected]
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: [email protected]
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