'<xyicons>' is interpolated within single-quotes

Things you’d like to miss in the future...
Forum rules
You might want to read this if you're looking for priority service

:info: Please Include The Following Information
1) Your XYplorer Version (e.g., v28.00.0801)
2) Your Windows Version (e.g., Win 11)
3) Your Screen Scaling Percentage (e.g., 125%).

:info: Use Your Profile Or Signature
We strongly recommend adding your Windows Version and Screen Scaling Percentage to the Location field in your Profile or to your Signature. That way, you only have to type them once, and we won't have to search for that vital information.

:info: How To Attach Images
When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".
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: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @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: 15016
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @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: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

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.

admin
Site Admin
Posts: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @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: 67271
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @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