Post Reply 
Global vs Local behaviour
05-04-2015, 01:32 PM
Post: #9
RE: Global vs Local behaviour
(05-04-2015 11:34 AM)DrD Wrote:  I think I may have found something I hadn't noticed before, which may explain my concern being debated in this discussion. Apparently, if a variable is created via the command line, (for example and notice Type: string):

[HOME]stg:="Stuff";

Now you have created a User Variable as you can see with the Vars key:

[Image: a0pp11]

(05-04-2015 11:34 AM)DrD Wrote:  and then a program using that variable name "EXPORT str(stg)" just gets COMPILED, it destroys the original value, in what I was thinking was a global variable, (compile, but don't run this yet):

Code:

EXPORT stg;
EXPORT str(stg)  
BEGIN      
  return stg;
END;

Now you have created another stg global variable in the str context:

[Image: a0pp0w]

(05-04-2015 11:34 AM)DrD Wrote:  Notice that the value of the (global?) command line variable stg gets destroyed:

[HOME]stg; ===> 0.00 (Type: real)

It seems like the compiler over-writes the (pre-existing) initial command line version. Thoughts, bug (y/n)?

-Dale-

The latest referenced "stg" variable is the one accessed, but the original one has not been destroyed as you can retrieve it's content if you delete the str program.
If you have two global variables with the same name (stg) Exported from two programs (pgm1, pgm2) you can access them as pgm1.stg and pgm2.stg, what I don't know is which qualifier you should use to access the stg User Variable.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Global vs Local behaviour - DrD - 05-02-2015, 03:24 PM
RE: Global vs Local behaviour - kharpster - 05-02-2015, 08:38 PM
RE: Global vs Local behaviour - DrD - 05-02-2015, 09:56 PM
RE: Global vs Local behaviour - kharpster - 05-02-2015, 10:29 PM
RE: Global vs Local behaviour - DrD - 05-03-2015, 02:18 AM
RE: Global vs Local behaviour - kharpster - 05-03-2015, 08:33 PM
RE: Global vs Local behaviour - DrD - 05-04-2015, 11:34 AM
RE: Global vs Local behaviour - Didier Lachieze - 05-04-2015 01:32 PM
RE: Global vs Local behaviour - DrD - 05-04-2015, 01:47 PM
RE: Global vs Local behaviour - leprechaun - 05-04-2015, 05:47 PM



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