Page 2 of 2

Re: Scripting Bugs

Posted: 20 Mar 2015 09:08
by admin
... and beyond. :mrgreen:

Re: Scripting Bugs

Posted: 20 Mar 2015 12:06
by PeterH
admin wrote: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}'>);
For me it shows that there's something wrong in the concept. (Beside the situation, that stacking quotes often looks quite strange...)

But in general: what's a constant, and what's a variable? For example:
$g = genericfiletype; echo eval(<get "$g" '{:Image}'>);
OK: the left side must be quoted if I'm right: $g = 'genericfiletype';
So $g is a variable containing a string. Then in
echo eval(<get "$g" '{:Image}'>);
$g is a variable :biggrin: and *may* be in double quotes. I think this is in conflict with your definition, as I think(!) you use the quotes to recognoize the 1st "operand" for the get?

For me:
echo <get "genericfiletype" '{:Image}'>;
is straight forward as expected. (The complete <get ...> is a special *variable* and can be used unquoted.

echo "<get "genericfiletype" '{:Image}'>"; //hmm...
For me this looks like a syntax error :-(

echo "<get ""genericfiletype"" '{:Image}'>"; //hmm...
Formally it looks clean :arrow: inside double quotes: double double quotes, use single quotes. (The latter looks better...)

echo eval("<get " . "genericfiletype" '{:Image}'>);
:shock: is this a concatenation of parts of a variable???
Then for "abc=$abc" you should be able to write "abc=$a"."bc" :shock:

Back to the roots: what are these "operands" in a <get ...>?
- they might be strings ==> must be quoted
- they might be codewords ==> unquoted, but no operand may contain spaces.
And the latter is unusual for XY: operands usually don't use codewords ( Status "msg", "ff0000", "alert"; ) Here alert is a string (representing a codeword), not a direct codeword. Advantage af a string: can be replaced by a variable - a codeword can't.

So I'm afraid: some thinking is required - or syntax can't become clean.
The root of problems seems to be a "variable" <get ...> containing strings.

(By the way: there *are* codewords, that are no strings: get, or substr for example.)

Sorry for long post, wasn't able to get it shorter :oops:

Re: Scripting Bugs

Posted: 20 Mar 2015 15:36
by admin
These were just some partly extreme examples of what works. I did not mean them to be suggestions.

The recent changes were done to achieve more consistency between get(...) and <get ...>.

But there is at least one fundamental syntactic difference:
In get(...) arguments are separared by commas, therefore arguments containing a comma MUST be quoted.
In <get ...> arguments are separared by spaces, therefore arguments containing a space MUST be quoted.

Re: Scripting Bugs

Posted: 20 Mar 2015 16:19
by bdeshi
Seeing the blatant and horrific disregard for sanity syntax that the newly risen <get > displays, I'm tempted to say the old way was better; not "better" better, "less worse" better.

Re: Scripting Bugs

Posted: 20 Mar 2015 16:30
by admin
The old way is still there.

Re: Scripting Bugs

Posted: 20 Mar 2015 17:20
by bdeshi
can't deny that. So there's a compromise: either strict quotes or quotes galore!

"The new way" is not really unbearable and more than what I wanted, but only creates a different kind of headache.
how do you make this work anyway?

Code: Select all

echo  "<get "genericfiletype" '{:Image}'>";  //hmm...
is it interpreted like this?

Code: Select all

echo "<get ". genericfiletype . " '{:Image}'>";

Re: Scripting Bugs

Posted: 20 Mar 2015 21:55
by TheQwerty
Can we just stop using the variable version of Get in places where it makes no sense?

It only exists to provide access to the capabilities of the Get command in places where scripting is not available - the title bar template being the main one.

If you are writing a script there is absolutely no reason to ever use <get ...> or <prop ...>.

Re: Scripting Bugs

Posted: 20 Mar 2015 22:56
by PeterH
TheQwerty wrote:Can we just stop using the variable version of Get in places where it makes no sense?

It only exists to provide access to the capabilities of the Get command in places where scripting is not available - the title bar template being the main one.

If you are writing a script there is absolutely no reason to ever use <get ...> or <prop ...>.
Makes sense? Lazyness? :roll:

You can use <get ...> inside a double-quoted string.
With get() you have to break the string into parts, and use concatenation.

I think in the end you are right: the format of <get ...> being a variable, but containing "internal strings", isn't really good for scripts. The syntax doesn't really fit.
But it's there. So sometimes you are tempted... :whistle: