Perm/global and native variables

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
Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Perm/global and native variables

Post by Marco »

Code: Select all

perm $a = "<xyscripts>"; echo "$a";
shows literally <xyscripts> instead of the resolved path. Even on fresh install.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Perm/global and native variables

Post by PeterH »

Didn't test till now, so just to say: I'd expect that in this statement you can specify anything you could specify behind a "=" elsewhere?

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Perm/global and native variables

Post by Marco »

I guess so. Trouble only shows up with native variables, other strings are fine.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Perm/global and native variables

Post by PeterH »

Marco wrote:I guess so. Trouble only shows up with native variables, other strings are fine.
I didn't only think of strings, but also functions like substr(), concatenations, etc.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Perm/global and native variables

Post by Marco »

Ah ok, got it now. Well... I still think so.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: Perm/global and native variables

Post by FluxTorpedoe »

Hi there, been a while! :)

I ran into this situation before, and it looks like when simultaneously declaring and assigning a variable, its value (e.g. native vars) isn't evaluated. So I guess in general we'd better declare perms and globals first, then assign them.
i.e.:

Code: Select all

perm $a;
  $a = "<xyscripts>"; echo "$a";
I don't know if that was really the point of your question...
...Trying to get back in XY saddle 8)

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Perm/global and native variables

Post by PeterH »

FluxTorpedoe wrote:Hi there, been a while! :)

I ran into this situation before, and it looks like when simultaneously declaring and assigning a variable, its value (e.g. native vars) isn't evaluated. So I guess in general we'd better declare perms and globals first, then assign them.
i.e.:

Code: Select all

perm $a;
  $a = "<xyscripts>"; echo "$a";
I don't know if that was really the point of your question...
...Trying to get back in XY saddle 8)
Just try:

Code: Select all

 perm $a;
  $a = "<xyscripts>"; echo "$a";

 perm $b = "<xyscripts>"; echo "$b";

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: Perm/global and native variables

Post by FluxTorpedoe »

Hmm, then I clearly misunderstood your question, sorry. I still don't know what you're pointing at, since in your last example you're again simultaneously declaring and assigning $b, instead of declaring it first.

Code: Select all

 perm $a, $b;
  $a = "<xyscripts>"; echo "$a";
  $b = "<xyscripts>"; echo "$b";
But maybe that's what you were stressing out since it's working with regular values... well, I guess I should get some sleep. ;)

PeterH
Posts: 2830
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Perm/global and native variables

Post by PeterH »

FluxTorpedoe wrote:Hmm, then I clearly misunderstood your question, sorry. I still don't know what you're pointing at, since in your last example you're again simultaneously declaring and assigning $b, instead of declaring it first.

Code: Select all

 perm $a, $b;
  $a = "<xyscripts>"; echo "$a";
  $b = "<xyscripts>"; echo "$b";
But maybe that's what you were stressing out since it's working with regular values... well, I guess I should get some sleep. ;)
Yes, no, ahhh... :roll:

It's so: implicit assigning a value while defining is quite new implemented by Don - and Marco want's to use that, I think.
(And in the next days I'll use that, too...)

In between the time we found out that this implicit assignment worked wit 12.10.0013, but refused to work with 0014 - so we had some problems to synchronize our findings and see the root of the problem :biggrin:

FluxTorpedoe
Posts: 906
Joined: 05 Oct 2011 13:15

Re: Perm/global and native variables

Post by FluxTorpedoe »

Ohhh okay, I really missed some wagons there! :wink:
And I also have to head into these new toys of "_Initialize" & Co... So I'll leave you to do the spadework while I'll get back to my homework! ;)

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

Re: Perm/global and native variables

Post by admin »

Marco wrote:

Code: Select all

perm $a = "<xyscripts>"; echo "$a";
shows literally <xyscripts> instead of the resolved path. Even on fresh install.
Confirmed. Should work as expected next time.

Marco
Posts: 2354
Joined: 27 Jun 2011 15:20

Re: Perm/global and native variables

Post by Marco »

PeterH wrote:Yes, no, ahhh... :roll:

It's so: implicit assigning a value while defining is quite new implemented by Don - and Marco want's to use that, I think.
(And in the next days I'll use that, too...)

In between the time we found out that this implicit assignment worked wit 12.10.0013, but refused to work with 0014 - so we had some problems to synchronize our findings and see the root of the problem :biggrin:
Yep, I'm playing with the (really) new stuff. So 0014 broke something?
FluxTorpedoe wrote:Ohhh okay, I really missed some wagons there! :wink:
And I also have to head into these new toys of "_Initialize" & Co... So I'll leave you to do the spadework while I'll get back to my homework! ;)
Yeah there are a couple of new neat toys :D

Thanks Don for fixing it.
Tag Backup - SimpleUpdater - XYplorer Messenger - The Unofficial XYplorer Archive - Everything in XYplorer
Don sees all [cit. from viewtopic.php?p=124094#p124094]

Post Reply