quotes in function-variables (<get >, <prop >)
Posted: 18 Mar 2015 20:19
get() -> genericfiletype doesn't work as expected if filetype is provided in single-quotes '{:Media}' . Is it bad, doc?
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
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}">;Code: Select all
::text <prop System.Volume.IsRoot>;
text <prop "System.Volume.IsRoot">;You mean this?SammaySarkar wrote:PeterH will go mad!
Code: Select all
echo <get genericfiletype "{:Image}">;
echo <get genericfiletype '{:Image}'>;
echo <get 'genericfiletype' '{:Image}'>;
echo <get "genericfiletype" "{:Image}">;
text <prop "System.Volume.IsRoot">;That was a bit of a misnomer - you can't just remove the quotes, XY does not perform double interpolation.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.
Code: Select all
echo how "are" you?;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!
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!
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}'>);Code: Select all
echo "<get "genericfiletype" '{:Image}'>"; //hmm...