Post Reply 
Global variable
06-26-2017, 11:48 AM
Post: #4
RE: Global variable
I like to use reserved variables in programs, as they are very efficient. For example, they don't have to be explicitly declared. They live beyond program execution. They are very useful for debugging, or further, (external), processing.

While a program is operating, the content of global variables is manageable. The content TYPE is always known. While there is no guarantee that outside influences might not, subsequently, modify reserved, (or other global variables), that content remains under program control within the program. The data is changeable externally. (So don't use global's for constants)! Use of global variables is a programming simplification, one that all levels of programming experience can appreciate.

Cyrille, can you explain a little further why the use of global variables is not a good idea, or why they should generally be avoided? Perhaps, due to system memory management issues, etc.? (Very infrequently, I have had to "Reset" the emulator, for example. I have not had to do that with the physical calculator, so far). Also, (so far), I have not encountered any downside to using Reserved variables, and I have used them frequently.

An enhancement suggestion: creation of a HOME "RESTART" version of the CAS "restart" command to reset all Reserved variables to their initial value, with [options] for [A]LL reserved variables, or to omit [L]ists, [M]atrices, etc.

As usual, I appreciate your greater knowledge, and look forward to learning from your explanations!

-Dale-
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Global variable - Powersoft - 06-25-2017, 06:56 PM
RE: Global variable - DrD - 06-25-2017, 07:46 PM
RE: Global variable - toml_12953 - 06-26-2017, 12:27 PM
RE: Global variable - DrD - 06-26-2017 11:48 AM
RE: Global variable - Han - 06-26-2017, 03:09 PM
RE: Global variable - DrD - 06-26-2017, 04:02 PM
RE: Global variable - Han - 06-26-2017, 08:29 PM
RE: Global variable - DrD - 06-26-2017, 09:04 PM
RE: Global variable - DrD - 06-27-2017, 11:32 AM



User(s) browsing this thread: 1 Guest(s)