Probably...admin wrote:Wow, little overkill maybe?
And the Interpolate SC is definitely.
Probably...admin wrote:Wow, little overkill maybe?
I have just been wondering how to avoid the variable on left side in a Heredoc from resolving. I had been using a place holder variable but it gets unmanagable with longer scriptsIf you wanted to go even further - I know we've seen some requests for fine tuning which variables are resolved so this deref SC could really be an interpolate SC with flag:
Code: Select all
$flag=1 ;
$Check=<<<FOO
$flag=2 ;
#Foo ;
Code: Select all
$flag=1 ;
$var_flag = '$flag' ;
$Check=<<<FOO
$var_flag=2 ;
#Foo ;
Code: Select all
$flag=1 ;
$Check=<<<FOO
$flag=2 ;
FOO;Code: Select all
$flag = 1;
$Check = <<<FOO
$:flag = $flag + 2;
FOO;
$Check = Replace($Check, '$:', '$');
Text $Check;Code: Select all
$flag = 1;
$Check = <<<FOO
<$ flag> = $flag + 2;
FOO;
Text $Check;Yes, but only here. I typed it from memory and is was a dummy code.PeterH wrote:Maybe some typo?
It was just a simple example. I have some scripts which I have added as UDC and use Heredoc to generate a runtime menu and load it - like here http://www.xyplorer.com/xyfc/viewtopic. ... 30#p104976TheQwerty wrote:No matter what using the same variable names sure makes it difficult to find a compromise between the desired functionality and legible code.
This sounds great.TheQwerty wrote: Maybe Don could give us a new XY var: '<$ flag>' which would get resolved to '$flag' thus making the above:I suppose that could also offer another way to do derefs: '<*$ flag>'Code: Select all
$flag = 1; $Check = <<<FOO <$ flag> = $flag + 2; FOO; Text $Check;