[DGD]Global/Local Variables

Neil McBride nmcbride at ozemail.com.au
Thu Jul 22 09:55:01 CEST 1999


Hiyas,

I'm having a small problem with an object and the variables used within it's
functions.  The object itself contains no global variables as such, but each of the
functions uses local variables.  Now, I've used the same variable name in each
function to serve similar purposes. The variable is defined as a different type
depending on it's use in the particular function.

Now, my problem is that this variable with the same name is behaving as a global
variable under certain situations.  Ie, I enter function 1 and the variable x is a
mapping with two keys.  I run function 2, passing the x as the argument and modify
the data in function 2. Function 2 then finishes and function 1 continues on.
However, the value's within the mapping have now changed according to anything that
was done to function 2's x variable.

Now, as I understand how it's supposed to work, this should _not_ happen unless I'm
passing pointers around, which I'm clearly not (can you even do that under DGD??)
Is this the expected behaviour or is there something amiss here?

Any help appreciated,

TIA

Neil.



List config page:  http://list.imaginary.com/mailman/listinfo/dgd



More information about the DGD mailing list