Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Macro substitution
Message
From
27/12/2002 07:56:07
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
27/12/2002 07:50:45
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00735756
Message ID:
00736017
Views:
25
>Macro substitution is obviously a legitimate programming technique and one which I think is awesomely powerful. However, it is also a very often miss-used technique.

Personally, I think macro substitution can be justified for simplifying SQL - SELECT statements with lots of variable information (see my reply to Peter), and in some other cases where it turns out that many more commands are required if you insist on avoiding macro substitution. One interesting example is to restore SET settings:
set talk &lcOldTalk
is one single command. To avoid macro substitution, you would need five:
if lcOldTalk = "ON"
  set talk on
else
  set talk off
endif
If the saving / restoring is done frequently, it might be worthwhile to investigate which version is faster. (Is it the second version? I suppose so, but I am not sure in this case). Otherwise, I would prefer the single command.

Hilmar.
Difference in opinions hath cost many millions of lives: for instance, whether flesh be bread, or bread be flesh; whether whistling be a vice or a virtue; whether it be better to kiss a post, or throw it into the fire... (from Gulliver's Travels)
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform