Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Use of macro substitution vs. string valued variables
Message
From
23/07/1999 03:47:29
 
 
To
22/07/1999 11:56:47
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00244254
Message ID:
00245197
Views:
22
Hi all three Davids,

There is more fun, after I upgrade to VFP 6.0 I found I need to do something with the command set collate, here is what I found:

coldcollate = set("collate")
set collate to &coldcollate && NOT WORKING
set collate to coldcollate && WORKING


It seems that there are no consistency in the VFP SET command at all.

Chen



>>I am not surprised by the following:
>>coldsafety = set("safety")
>>set safety &coldsafety && Working
>>set safety (coldsafety) && NOT Working
>>set safety eval("coldsafety") && NOT Working
>>

>>
>>However, I am surprised by:
>>colddate = set("date")
>>set date &colddate && Working as usuall
>>set date (colddate) && WOKING!!!
>>set date eval("colddate") && WOKING!!!
>>

>>
>>What are going on here?

>
>I have a guess.
>
>set safety is a command that takes no arguments! Actually, there is no SET SAFETY command! There is a "SET SAFETY OFF" command and a "SET SAFETY ON" command. So literal string substitution works, but trying to use a run-time calculated value causes a syntax error.
>
>set date is a command that takes a single argument. That argument may be a constant (a macro evaluates to a string constant, so it's OK) or it may be a run-time evaluated variable.
>
>In other words, the general syntax for SET commands is not a good example of language design. But hey, nobody's perfect.
Chen Nan
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform