Page 1 of 2

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

Posted: 18 Mar 2015 20:19
by bdeshi
get() -> genericfiletype doesn't work as expected if filetype is provided in single-quotes '{:Media}' . Is it bad, doc?

Re: Scripting Bugs

Posted: 18 Mar 2015 20:36
by admin
works here :?

Re: Scripting Bugs

Posted: 19 Mar 2015 15:06
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.

Re: Scripting Bugs

Posted: 19 Mar 2015 15:29
by admin
Not a bug, but not a feature. :)

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

Re: Scripting Bugs

Posted: 19 Mar 2015 15:39
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!

Re: Scripting Bugs

Posted: 19 Mar 2015 16:06
by admin
Your point is not totally invalid. :)

Re: Scripting Bugs

Posted: 19 Mar 2015 16:08
by bdeshi
SammaySarkar wrote:PeterH will go mad!
You mean this? :mrgreen:

Re: Scripting Bugs

Posted: 19 Mar 2015 16:12
by admin
:lol: :biggrin:

Re: Scripting Bugs

Posted: 19 Mar 2015 16:16
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.)

Re: Scripting Bugs

Posted: 19 Mar 2015 16:26
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.

Re: Scripting Bugs

Posted: 19 Mar 2015 16:40
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!

Re: Scripting Bugs

Posted: 19 Mar 2015 16:45
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!

Re: Scripting Bugs

Posted: 19 Mar 2015 23:13
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:

Re: Scripting Bugs

Posted: 20 Mar 2015 08:53
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}'>);

Re: Scripting Bugs

Posted: 20 Mar 2015 09:05
by bdeshi

Code: Select all

echo  "<get "genericfiletype" '{:Image}'>";  //hmm...
a step towards artificial intelligence...