Documentation of "set $x, [reprocess]"
Posted: 02 Apr 2012 14:16
The description of the set command, as well as the description of it's reprocess-operand seem to say that the last operand is "reprocess". Only some lines below under The reprocess argument it is mentioned, that it's only "r"!
I'd think it would be better to also allow "reprocess", (sure: don't delete "r",) and to mention both names in the operand description reprocess:
For the form $x = $y, "r";, info follows only inside the description of the set command. But I think people will look in: Advanced Topics / Scripting / Variables / Using the equal operator (=) - so I think there should be a note for reprocess, too. Sure it may refer to Scripting Commands / set.
-----
Edit - to the following wish: seems my expectations on eval() were too high: maybe it's exactly what I should use here?
Thought eval() would execute complete instructions, but it doesn't do that...
As being related to this, a wish: reprocess works on <...> and %...% variables. I think it could be very useful if it would also work on the normal $... variables! I think if a $...-name is used inside the text of a reprocessed string, it will be meant to be reprocessed.
(I just assumed this - and had to find out that it's not done...)
I know eval() could be used here - but as my request refers just to the values for variable names, not to the complete expression, I think it would be easier. And as other variables are resolved here...
My idea:(OK: if we had subroutines...)
You also could refer to array elements:(But to set an element eval() can't be avoided.)
I'd think it would be better to also allow "reprocess", (sure: don't delete "r",) and to mention both names in the operand description reprocess:
For the form $x = $y, "r";, info follows only inside the description of the set command. But I think people will look in: Advanced Topics / Scripting / Variables / Using the equal operator (=) - so I think there should be a note for reprocess, too. Sure it may refer to Scripting Commands / set.
-----
Edit - to the following wish: seems my expectations on eval() were too high: maybe it's exactly what I should use here?
Thought eval() would execute complete instructions, but it doesn't do that...
As being related to this, a wish: reprocess works on <...> and %...% variables. I think it could be very useful if it would also work on the normal $... variables! I think if a $...-name is used inside the text of a reprocessed string, it will be meant to be reprocessed.
(I just assumed this - and had to find out that it's not done...)
I know eval() could be used here - but as my request refers just to the values for variable names, not to the complete expression, I think it would be easier. And as other variables are resolved here...
My idea:
Code: Select all
$script = "name";
$pre = '$list<crlf><date hh:nn:ss> $script:'; // once define a line-prefix
$list = ""; // init list to empty
// ... and then several times with varying text inside the script:
$list = "$pre An added line.", "r"; // add a line to the list
// ... instead of
$list = "$list<crlf><date hh:nn:ss> $script: An added line."; // add a line to the list
You also could refer to array elements:
Code: Select all
$x = 3;
$y = 5;
$i = '$i'.$x."_".$y, "r"; // $i = $i3_5;