[FIXED] Bug with Dereference Operator
Posted: 26 Jun 2014 11:54
Edit: please see the corrected and expanded example in my post of 28 Jun 2014!
I hope this can be seen as a
works as expected.
In another script, used as a subroutine, I want to use the already defined contents of $n, so:But: impossible! The Global *without* initialization results in error msg:
As Global and Perm are used to share values, it wouldn't make sense always to initialize them when defining, and lose the current contents. So I'm convinced it's a
By the way: would it be possible to automatically add the $ to the dereference name, if it's missing? I think it's unique. Then creating the name would be much easyer - example:(Usually my procedures have some more parameters - then it really makes a difference...)
And another "by the way": nobody else uses this? It seems to have a lot of power
I hope this can be seen as a
Code: Select all
$str = '$str'.1;
Global *$str = 1;
In another script, used as a subroutine, I want to use the already defined contents of $n, so:
Code: Select all
$str = '$str'.1;
Global *$str;
- Not a valid variable name: *$str
A variable must begin with $, followed by a name.
The script is terminated now.
global
*$str
As Global and Perm are used to share values, it wouldn't make sense always to initialize them when defining, and lose the current contents. So I'm convinced it's a
By the way: would it be possible to automatically add the $ to the dereference name, if it's missing? I think it's unique. Then creating the name would be much easyer - example:
Code: Select all
$nr = 2; // maybe a paramter :biggrin:
$str = "str$nr"; // to address $str2 - easy if you must not code $str here!
Global *$str;
And another "by the way": nobody else uses this? It seems to have a lot of power