Page 1 of 1

Simply reporting bug: No throwing for &x1??x2 but an undefined behavor

Posted: 02 Aug 2023, 02:29
by V2User
Simply report a small bug without clear purposes. The behavior of c:=&x1??x2 is not defined nor throwing.
Code:

Code: Select all

x3:=5
x2:=&x3
c:=&x1??x2
OutputDebug(%c%) ;perhaps expect 5 but got x1's value.
image.png
image.png (46.26 KiB) Viewed 879 times

Re: Simply reporting bug: No throwing for &x1??x2 but an undefined behavor

Posted: 02 Aug 2023, 03:49
by Descolada
I would expect &x1 to return a VarRef pointing to an unset variable (x1), and since VarRef is not an unset then c:=&x1??x2 evaluates to c:=&x1. Not a bug IMO.

Re: Simply reporting bug: No throwing for &x1??x2 but an undefined behavor

Posted: 03 Aug 2023, 01:55
by lexikos
The reference operator has higher precedence. This should probably raise a syntax error (not throw) as the reference operator cannot ever produce unset, but the current version is very limited in how the ? and ?? operators can be used or validated.

Re: Simply reporting bug: No throwing for &x1??x2 but an undefined behavor  Topic is solved

Posted: 15 Aug 2023, 05:47
by lexikos
This causes a load-time error in v2.1-alpha.2, as intended.