'<xyicons>' is interpolated within single-quotes

Things you’d like to miss in the future...
Post Reply
zhaowu
Posts: 30
Joined: 24 Oct 2016 16:03

'<xyicons>' is interpolated within single-quotes

Post by zhaowu »

Code: Select all

    $var = '<xyicons>';
    msg $var;
The $var is interpolated and the msg is something like C:\xxx\XYplorer\Data\Icons

admin
Site Admin
Posts: 60525
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: '<xyicons>' is interpolated within single-quotes

Post 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. :eh:

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?

highend
Posts: 13308
Joined: 06 Feb 2011 00:33

Re: '<xyicons>' is interpolated within single-quotes

Post by highend »

It would indeed break old code. Would leave it as it is...
One of my scripts helped you out? Please donate via Paypal

admin
Site Admin
Posts: 60525
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: '<xyicons>' is interpolated within single-quotes

Post 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. :|

PeterH
Posts: 2785
Joined: 21 Nov 2005 20:39
Location: Germany

Re: '<xyicons>' is interpolated within single-quotes

Post 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.
Win11 Pro 223H2 Gerrman

admin
Site Admin
Posts: 60525
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: '<xyicons>' is interpolated within single-quotes

Post by admin »

Yes, I agree, and that's exactly how I implemented it.

zhaowu
Posts: 30
Joined: 24 Oct 2016 16:03

Re: '<xyicons>' is interpolated within single-quotes

Post 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);
}


admin
Site Admin
Posts: 60525
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: '<xyicons>' is interpolated within single-quotes

Post by admin »

I see. So, since v19.50.0116 it works again, right?

zhaowu
Posts: 30
Joined: 24 Oct 2016 16:03

Re: '<xyicons>' is interpolated within single-quotes

Post 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!

Post Reply