Page 1 of 1
'<xyicons>' is interpolated within single-quotes
Posted: 06 Jan 2019 06:45
by zhaowu
The
$var is interpolated and the msg is something like
C:\xxx\XYplorer\Data\Icons
Re: '<xyicons>' is interpolated within single-quotes
Posted: 08 Jan 2019 15:00
by admin
Hmm, a tricky case.
First, the variable $var is set to "<xyicons>", so it is not interpolated within single-quotes.
But then, the variable $var is resolved to "<xyicons>" which then is
resolved again to the path.
The second part is problematic. I think it's probably something that should be changed, but that could break old code.
FYI, this double-resolving happens since I made this work in
v18.60.0102 - 2018-01-10 15:59:
Code: Select all
$ms = "fff"; echo "now: " . <date hh:nn:ss.$ms>;
Opinions?
Re: '<xyicons>' is interpolated within single-quotes
Posted: 08 Jan 2019 15:20
by highend
It would indeed break old code. Would leave it as it is...
Re: '<xyicons>' is interpolated within single-quotes
Posted: 08 Jan 2019 15:24
by admin
Damn, I just decided the other way. The correct code for double-resolving should be this:
Code: Select all
$var = '<xyicons>'; msg eval($var);
The current behavior is simply wrong.

Re: '<xyicons>' is interpolated within single-quotes
Posted: 08 Jan 2019 15:48
by PeterH
Hm - *must* it be so that the resolving inside <...> is the same as that in $xxx?
Because I understand the double resolving in <date hh:nn:ss.$ms>, but don't expect it in the msg $var; expression.
Maybe treat the string inside <...> analog to a *double* quoted string, i.e.,variables are resolved?
No question: what you said about eval is correct for "normal" variables. But I think of <...> more as of a "kind of" function.
Re: '<xyicons>' is interpolated within single-quotes
Posted: 08 Jan 2019 16:59
by admin
Yes, I agree, and that's exactly how I implemented it.
Re: '<xyicons>' is interpolated within single-quotes
Posted: 12 Jan 2019 06:00
by zhaowu
admin wrote: ↑08 Jan 2019 15:24
Damn, I just decided the other way. The correct code for double-resolving should be this:
Code: Select all
$var = '<xyicons>'; msg eval($var);
The current behavior is simply wrong.
This is how I found this problem. The code was intended to replace
copy path with shorter and portable path when I add custom icons like:
Downloads|<xyicons>\Essential\arrow-download.ico for Captions.
Code: Select all
foreach($var, '<xyicons>|<xyscripts>|<xydata>') {
$path = replace($path, eval($var), $var, 1);
}
Re: '<xyicons>' is interpolated within single-quotes
Posted: 12 Jan 2019 10:40
by admin
I see. So, since v19.50.0116 it works again, right?
Re: '<xyicons>' is interpolated within single-quotes
Posted: 13 Jan 2019 03:47
by zhaowu
admin wrote: ↑12 Jan 2019 10:40
I see. So, since v19.50.0116 it works again, right?
Yes, it is working now. Thanks!