Scripting Bugs

Things you’d like to miss in the future...
Forum rules
:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:

: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: We 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.

:info: When attaching an Image, please use the Attachment tab at the bottom of your post and click "Add files".

:warnred20: :warnred20: :warnred20: :warnred20: :warnred20: READ THIS AND DO IT!!! :warnred20: :warnred20: :warnred20: :warnred20: :warnred20:
PeterH
Posts: 2826
Joined: 21 Nov 2005 20:39
Location: DE W11Pro 24H2, 1920*1200*100% 3840*2160*150%

Re: Scripting Bugs

Post by PeterH »

admin wrote:Yes, this is bad. :evil: Any ideas?
If you would add ++$i, I'd change all my scripts :biggrin: :wink:

OK: it's a hard decision for you. As this would be the correct usage, I'd really change my scripts - though it's a bit of work to do. And these scripts would not be compatible with old XY-versions.

But what do others say? Or is $i++ as part of an equation, or an operand for a called function, (i.e. not stand-alone) only rarely used? (I used these both, and stand-alone...)
But I think the number of scripts is limited for everybody - and you can search for "++". Change really would be easyest if you just could change $i++ to ++$i, else you have to change start-values, limits, etc.

(I'm now off for some hours.)

edit: typo

Filehero
Posts: 2720
Joined: 27 Feb 2012 18:50
Location: Windows 11@100%

Re: Scripting Bugs

Post by Filehero »

PeterH wrote:But what do others say?
Indeed, deprecating a language's syntax w/o generating any troubles is tough stuff.

Hmm, let's summarize what we have
- a user who submitted a bug or hint to some remaining inconsistency
- a language owner who hates signs of imperfection or inconsistency more than (almost) anything else
- more users who share the opinion of the bug submitter - and belong to the crowd of major script suppliers

To me it's clear: improve the syntax - every single following "uarggggg, wtf" will be cared for quite fast here. :wink:

@Don: I guess you don't want the SC engine to support different syntax versions at all, right?


Cheers,
Filehero

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

Re: Scripting Bugs

Post by admin »

Filehero wrote:@Don: I guess you don't want the SC engine to support different syntax versions at all, right?
That would be a nightmare.

Given that XY scripting syntax closely follows PHP syntax ever since, the old behavior could be seen as a bug. So this is a bug fix. And by all means it should be done.

klownboy
Posts: 4398
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.7171 at 100% 2560x1440

Re: Scripting Bugs

Post by klownboy »

Thanks the Qwerty for the explanations, as both you and Don stated it all has to do with "variables first incremented and then returned" vs "returned and then incremented".

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

Re: Scripting Bugs

Post by PeterH »

Just tested with the "expanded dereference operator". (v14.30.0001)

Great!!! :-)

Code looks much better this way. Though I will wait a bit before change real life 8)
Some (rather unrelated) examples "before":

Code: Select all

  *$sectpk = Eval($sect);

  If (Eval($nf) >= Eval($lnef))
  { *$nf = Eval($lnef) + 1;
    *$sectpk = Eval($sect);
  }

  ForEach ($line, Eval($tf), "<crlf>")
And the same "after":

Code: Select all

  *$sectpk = *$sect;

  If (*$nf >= *$lnef)
  { *$nf = *$lnef + 1;
    *$sectpk = *$sect;
  }

  ForEach ($line, *$tf, "<crlf>")
It's better to write, and better to read, I think.
So thanks a lot, and :appl: :appl: :appl: :ball:


With the new $i++ I will wait a bit, as code will become backword incompatible.

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

Re: Scripting Bugs

Post by TheQwerty »

I think I've only used the increment operator on a line by itself so changing it isn't a big problem for me - even leaving it broken is okay with me just inconsistent with my experience. ;)

That said I'm curious if this is actually in-line with PHP as I would have thought the incrementing was done after the echo statement, though what that means for echo $a++ + $a++ I'm not entirely sure :?

Code: Select all

$a = 1; echo $a++ + 1; echo $a; //2; 2
      Note in the following that the left operand is incremented before the 
      right operand is added. Finally, after the addition, the right operand is 
      incremented:
        $a = 1; echo $a++ + $a++; echo $a; //3; 3 

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

Re: Scripting Bugs

Post by admin »

TheQwerty wrote:I think I've only used the increment operator on a line by itself so changing it isn't a big problem for me - even leaving it broken is okay with me just inconsistent with my experience. ;)

That said I'm curious if this is actually in-line with PHP as I would have thought the incrementing was done after the echo statement, though what that means for echo $a++ + $a++ I'm not entirely sure :?

Code: Select all

$a = 1; echo $a++ + 1; echo $a; //2; 2
      Note in the following that the left operand is incremented before the 
      right operand is added. Finally, after the addition, the right operand is 
      incremented:
        $a = 1; echo $a++ + $a++; echo $a; //3; 3 
I tested it with PHP. Yes, it's the same over there.

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

Re: Scripting Bugs

Post by TheQwerty »

admin wrote:I tested it with PHP. Yes, it's the same over there.
Figured you would have checked it but wanted to make sure. Turns out it's the same in C#, so I've learned something new today. :)

And with that knowledge I intend to continue my trend of avoiding incrementing within expressions. This power is better used by itself.

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

Re: Scripting Bugs

Post by PeterH »

Oh - is this a bug? Try:
$a = 1; echo " $a $a++ $a++ $a++ $a ";

Seems inside double quotes $a++ isn't recognized as a variable, so just taken as text.
I wouldn't expect this.

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

Re: Scripting Bugs

Post by admin »

PeterH wrote:Oh - is this a bug? Try:
$a = 1; echo " $a $a++ $a++ $a++ $a ";

Seems inside double quotes $a++ isn't recognized as a variable, so just taken as text.
I wouldn't expect this.
I would. :)

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

Re: Scripting Bugs

Post by TheQwerty »

PeterH wrote:Oh - is this a bug? Try:
$a = 1; echo " $a $a++ $a++ $a++ $a ";

Seems inside double quotes $a++ isn't recognized as a variable, so just taken as text.
I wouldn't expect this.
I would expect this to echo "1 1++ 1++ 1++ 1" just as I would expect $a = 1; echo "$a + 2"; to echo "1 + 2".

Though I'd have to re-read the acceptable characters for a variable name to determine what I'd expect from:
$a = 1; $a++ = 2; echo "$a $a++ $a++ $a++ $a"
EDIT: Though I'd hope this is actually an error with $a++ = 2 being invalid. /edit

And this is too much for a weekend...
$a = 1; *$a++ = 2; echo $a $a++ *$a *$a++;

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

Re: Scripting Bugs

Post by PeterH »

admin wrote:I would. :)
With a good reason?

I must admit: had this idea just for visualization of multiple ++ in one "expression".

Edit: OK - you might see this like a kind of function - and functions inside quotes :naughty: :whistle:

Edit2: though TheQwerty seems correct: the variable $a should have been recognized, so 1++
Edit3: it shouldn't only: it really does :biggrin: :appl: Sorry I remembered wrong! :oops:

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

Re: Scripting Bugs

Post by admin »

OK, conc. $i++: I decided to leave things as they are now (v14.30.0003). There is no other way to go. So scripts that use increments as an argument must be adjusted to the new way (FIRST assign current value, THEN increment).

autocart
Posts: 1356
Joined: 26 Sep 2013 15:22

Re: Scripting Bugs

Post by autocart »

Could it be that "copydata hwnd, data, mode" does not copy/send any data at all if data is an empty string? It seems my OnMessage-Reactor in my other proggi does not even react...

autocart
Posts: 1356
Joined: 26 Sep 2013 15:22

Re: Scripting Bugs

Post by autocart »

got an overflow 0 \ 0 error on loadtree with a long list of paths

Post Reply