Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Why?
Message
From
11/01/1999 17:44:02
 
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Re: Why?
Miscellaneous
Thread ID:
00174204
Message ID:
00174881
Views:
30
>>>>And you could probably expand an object reference via &objectname..&propertyname, but again, why, when name expansion is faster and isn't delimiter-sensitive?
>>>
>>>Well, I didn't say it was fast, just that it was possible. But there are instances where the syntax doesn't call for a name, and so a name expression isn't an option, in which case macro expansion is useful and it's nice to know how to do it.
>>
>>If that's the case, then EVAL() is an option.
>
>Sure. In the example I originally gave (to display the contents of a field when the table name and field name are variables) one could write
>
?eval(eval('lcTableName') + '.' + eval('lcFieldName'))
>instead of
>
?&lcTableName..&lcFieldName.
Actually, you could simply say EVAL(ALLTRIM(lcTableName - '.' - lcFieldName))

This is a single eval, and the ALLTRIM and "-" concatenations are only needed to deal with leading and trailing blanks. Without the issue of blanks (which macro evaluation can't handle in any case, since you can't macro expand the result of a function), EVAL(lcTableName + '.' + lcFieldName) works just great.

>
>>There are relatively few times where macro expansion is desirtable, and this particular case, it's simply the wrong thing to use.
>
>I think we both agree that a name expression is a better choice in this particular case. Again, I wasn't trying to defend the use of macro expansion so much as I was simply saying that it is syntactically possible to reference a table.fieldname that way.
>
>BTW, Ed, there are a few people whose posts I always read here on UT, and yours are among them. Thanks for the many and various insights along the way.

Thanks. for the compliment.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform