Page 24 of 41

Re: Scripting Bugs

Posted: 20 May 2014 08:08
by nerdweed
You can use this instead. Updating my latest post there with this as well

Code: Select all

If (substr($RecPath,0,2) == "\\" )  { $flag=1; }
Else { $flag = exists($RecPath) ; }
If ($flag > 0) {add the path to my list;}

Re: Scripting Bugs

Posted: 24 May 2014 14:49
by bdeshi
if you try syntactically invalid path with SC html (example>> ::html('C:'); <<) , a couple of weird mutant dialogs come up. :shock:
I understand the error here is with the script being incorrect, but still, can I call the resulting windows anything but bugs (really creepy ones too)?

Re: Scripting Bugs

Posted: 31 May 2014 12:18
by admin
Agreed, there is room for improvement. :)

Re: Scripting Bugs

Posted: 11 Jun 2014 19:39
by bdeshi
SC download: if the source url can not be loaded (shows error #0), the target file is still created and moreover, it's locked by XY. The pc is disconnected from the net, if it's relevant.

Re: Scripting Bugs

Posted: 11 Jun 2014 21:15
by admin
Completely confirmed and fixed. Thanks!

Re: Scripting Bugs

Posted: 08 Jul 2014 00:06
by PeterH
Some problem with *$nr++ - maybe :bug: ? (Or 'works as designed', as IBM might say :( )

A stmt *$nr++; is allowed.
Shouldn't it then also be allowed to code:

Code: Select all

 $nr = '$ind';
 Global *$nr = 5;
 $i = *$nr++;                              // wrong
 $char = Substr('123456789', *$nr++, 1);   // wrong
 Text "i='$i', char='$char', ind='$ind'";
 step;
Both *$nr++ always seem to be 0, no matter of value of *$nr :arrow: $i will be 0, Substr will take first char. *$nr is *not* incremented.

Of course:

Code: Select all

 $nr = '$ind';
 Global *$nr = 5;
 *$nr++;
 $i = Eval($nr); 
 $char = Substr('123456789', Eval($nr), 1);
 Text "i='$i', char='$char', ind='$ind'";
 step;
works OK.


By the way, in step mode: if the last stmt of a script doesn't work as expected, you have no chance to check variable contents, as the script ends immediately. As in the first example: here the Text command displays something unexpected, but vars can't be checked then. So it would be fine to be able to display variable contents also *after* execution of the last stmt of a (sub-)script.
I help myself by sometimes adding a Step-Instruction after the last instruction... :roll:

Re: Scripting Bugs

Posted: 08 Jul 2014 11:22
by admin
Confirmed.

1. Not supported. Maybe later.
2. Good idea, I make a note.

Re: Scripting Bugs

Posted: 08 Jul 2014 11:34
by PeterH
admin wrote:1. Not supported.
You are IBM :shock:

A bit expecting this I didn't create a :bug: -thread for this :roll:
(As can be seen: it can be circumvented. Problem is to know it :P )

So: in docu you should give info that *$var++; is supported only standalone, not as an operand, or right in a set instruction.
And you might make a note for this, too :biggrin:

Re: Scripting Bugs

Posted: 12 Jul 2014 00:35
by PeterH
Just saw this:

Code: Select all

v14.30.0001 - 2014-07-11 21:46
    + Scripting: The dereference operator * (asterisk) can now be used anywhere
      in a statetment.
        $var = '$a'; *$var = "TEST"; echo *$var;  //TEST
        $var = '$a'; *$var = "TEST"; echo "*$var, $a!";  //TEST, TEST!
        $var = '$a'; *$var = 1; echo 1 + *$var++; //3
    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Hey - looks very promising :shock:

But sorry need some time before I can test :cry:

Re: Scripting Bugs

Posted: 12 Jul 2014 01:09
by TheQwerty

Code: Select all

    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Granted I haven't test it but this seems wrong.

In every language I'm familiar with those examples would resolve $a to 1 and then increment it - so they'd echo 2 and the value of $a would become 2.

Your examples would be accurate if instead of "$a++" they were "++$a" but that's not supported.

Re: Scripting Bugs

Posted: 12 Jul 2014 01:50
by klownboy
I don't follow, when $a is 1, if echo $a++ yields 2 which it does, why wouldn't echo 1 + $a++ = 3 (which it does)?

Re: Scripting Bugs

Posted: 12 Jul 2014 02:12
by TheQwerty
klownboy wrote:I don't follow, when $a is 1, if echo $a++ yields 2 which it does, why wouldn't echo 1 + $a++ = 3 (which it does)?
It's the difference between $a++ and ++$a - though since XY doesn't support the latter it is somewhat moot.

In most languages...
$a++ means use the value of $a and then increment it.
++$a mens increment the value and then use it.

Code: Select all

$a = 1; $b = $a++;   $c = $a; echo "$a $b $c"; // should echo 1 1 2

$a = 1; $b = ++$a;   $c = $a; echo "$a $b $c"; // should echo 1 2 2

$a = 1; $b = ++$a++; $c = $a; echo "$a $b $c"; // should echo 1 2 3
So

Code: Select all

$a = 1;
 echo $a++;          // should echo 1 then set $a to 2.
 echo 1 + $a++;      // should echo 3 (1+2) then set $a to 3.
 echo 1 + $a++ + 1;  // should echo 5 (1+3+1) then set $a to 4.

Re: Scripting Bugs

Posted: 12 Jul 2014 09:33
by admin
TheQwerty wrote:

Code: Select all

    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Granted I haven't test it but this seems wrong.

In every language I'm familiar with those examples would resolve $a to 1 and then increment it - so they'd echo 2 and the value of $a would become 2.

Your examples would be accurate if instead of "$a++" they were "++$a" but that's not supported.
Damn, you are right. I checked it with PHP.

Back to work... :twisted: :cup:

Re: Scripting Bugs

Posted: 12 Jul 2014 11:28
by PeterH
admin wrote:
TheQwerty wrote:

Code: Select all

    ! Scripting: The following kind of statement was not parsed correctly. Now
      it is:
        $a = 1; echo 1 + $a++; //3
        $a = 1; echo $a++ + 1; //3
Granted I haven't test it but this seems wrong.

In every language I'm familiar with those examples would resolve $a to 1 and then increment it - so they'd echo 2 and the value of $a would become 2.

Your examples would be accurate if instead of "$a++" they were "++$a" but that's not supported.
Damn, you are right. I checked it with PHP.

Back to work... :twisted: :cup:
But now you have a problem: docu says:
  • You can also use $i++/$i-- as an argument. The value is incremented/decremented before it is passed to the function. ...
And there are people (like me) currently using it this way :x

Re: Scripting Bugs

Posted: 12 Jul 2014 11:56
by admin
Yes, this is bad. :evil: Any ideas?