Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How can I append without opening the edit window?
Message
From
28/06/2001 11:26:45
Hilmar Zonneveld
Independent Consultant
Cochabamba, Bolivia
 
 
To
28/06/2001 11:08:32
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00524283
Message ID:
00524732
Views:
15
>How difficult ? Why would I need the local declaration ? You mean it's sufficient to declare a memvar to make it available after method/event routine ends ??? If so how ?
>
>scatter memvar memo
>
>It's this simple since fox2.x (not seen fox1x).
>Cetin

No, I don't want to have the variable available after the method ends (this could be done by declaring the variable PUBLIC).

What I do try to do is to avoid variables from other procedures from being overwritten. In this sense, LOCAL is similar to PRIVATE. Imagine the following scenario:

Procedure_A declares a variable "Client_Code"
Procedure_A calls Procedure_B
Procedure_B issues a SCATTER, and changes the value of variable "Client_Code"
Procedure_B finishes
Procedure_A produces hard-to-debug errors, because the value of "Client_Code" changed.

This can be solved by issuing one of the following in Procedure_B:
local Client_Code
   or
private Client_Code
This way, Procedure_B uses its own copy of the variable, and doesn't overwrite the variable of Procedure_A.

Of course, it is quite possible you never encounter this situation, so "take it or leave it". However, I find it better to program "defensively": it is often better to avoid an error in the first place, than to debug it later.

And, since you would have to declare several LOCAL or PRIVATE variables, a single variable (SCATTER ... NAME) is much easier.

Regards, 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