quotes in function-variables (<get >, <prop >)

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".
bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

quotes in function-variables (<get >, <prop >)

Post by bdeshi »

get() -> genericfiletype doesn't work as expected if filetype is provided in single-quotes '{:Media}' . Is it bad, doc?
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Scripting Bugs

Post by admin »

works here :?

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Scripting Bugs

Post by bdeshi »

okay, it's when the functions are converted to variables.

Code: Select all

 echo get('genericfiletype', '{:Image}'); //all combinations of quotes work when functionized.
 echo  <get genericfiletype "{:Image}">;
 echo  <get genericfiletype '{:Image}'>;
 echo  <get 'genericfiletype' '{:Image}'>;
 echo  <get "genericfiletype" "{:Image}">;
And it's not only genericfiletype, nor only <get >

Code: Select all

 ::text <prop System.Volume.IsRoot>;
 text <prop "System.Volume.IsRoot">;
Not all get info types don't seem to be affected.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Scripting Bugs

Post by admin »

Not a bug, but not a feature. :)

I never claimed anywhere that single quotes work here. Nor that <prop> supports internal quotes.

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Scripting Bugs

Post by bdeshi »

eh? that seems pretty counter-intuitive: a string that can't be quoted?
Besides, it's only logical that get() and <get> have the same looks (well, almost, if you discount the absence of commas and braces)

PeterH will go mad!
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Scripting Bugs

Post by admin »

Your point is not totally invalid. :)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Scripting Bugs

Post by bdeshi »

SammaySarkar wrote:PeterH will go mad!
You mean this? :mrgreen:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

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

Re: Scripting Bugs

Post by admin »

:lol: :biggrin:

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

I'd consider all of these to be bad form because they result in confusing string usage:

Code: Select all

 echo  <get genericfiletype "{:Image}">;
 echo  <get genericfiletype '{:Image}'>;
 echo  <get 'genericfiletype' '{:Image}'>;
 echo  <get "genericfiletype" "{:Image}">;
 text <prop "System.Volume.IsRoot">;
Now if you want to replace '{:Image}' or 'System.Volume.IsRoot' with a variable what are you going to do?

(Frankly, this is why I also avoid these variables as much as possible.)

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Scripting Bugs

Post by bdeshi »

I'll remove the quotes when replacing them with variables.
But they have every right to be quoted as long as they're plain strings! :) it's just syntax.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Scripting Bugs

Post by TheQwerty »

SammaySarkar wrote:I'll remove the quotes when replacing them with variables.
But they have every right to be quoted as long as they're plain strings! :) it's just syntax.
That was a bit of a misnomer - you can't just remove the quotes, XY does not perform double interpolation.

I view this as no different from:

Code: Select all

echo how "are" you?;
And I think we all agree that while this works it is horrible form!

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

Re: Scripting Bugs

Post by admin »

it might be necessary though as in this example:

Code: Select all

    > In the change log of v14.80.0239 - 2015-03-05 15:04 I claimed "both work 
      the same":
        <get counticons "<cc_item>">
        <get counticons <cc_item>>
      Wrong! The second example will fail for filenames with spaces in them!

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

Re: Scripting Bugs

Post by PeterH »

SammaySarkar wrote:eh? that seems pretty counter-intuitive: a string that can't be quoted?
Besides, it's only logical that get() and <get> have the same looks (well, almost, if you discount the absence of commas and braces)

PeterH will go mad!
:mrgreen: :mrgreen:
Completely correct!
(Though it's too late now. :oops: )

Had a lot of laugh reading this communication!

And, though all seem to know it now: a string is a string and should be specified as - you guess what? - a string :mrgreen:

:lol: :lol: :lol:

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

Re: Scripting Bugs

Post by admin »

I share TheQwerty's mixed feelings about this. All these work now, and some of them do look a bit funny:

Code: Select all

echo  <get "genericfiletype" '{:Image}'>;
echo  "<get "genericfiletype" '{:Image}'>";  //hmm...
echo  "<get ""genericfiletype"" '{:Image}'>";  //hmm...
echo  eval("<get " . "genericfiletype" '{:Image}'>);
$g = genericfiletype; echo  eval(<get "$g" '{:Image}'>);

bdeshi
Posts: 4256
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612
Contact:

Re: Scripting Bugs

Post by bdeshi »

Code: Select all

echo  "<get "genericfiletype" '{:Image}'>";  //hmm...
a step towards artificial intelligence...
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Post Reply