Page 1 of 1

As designed or a bug?

Posted: Tue Jan 24, 2023 8:53 pm
by pkoopmanpk
In noticed some unexpected behaviour:

Code: Select all

Function Options(*DIRECT)

Define Field(#value1) Type(*INT)
Define Field(#value2) Type(*INT)
Define Field(#value3) Type(*INT)

#value1 := 1
#value2 := 2
#value3 := 3

#value1 #value2 #value3 := #value1 + #value2 + #value3

Use Builtin(MESSAGE_BOX_ADD) With_Args(('value1: &1').substitute( #value1.AsString ))
Use Builtin(MESSAGE_BOX_ADD) With_Args(('value2: &1').substitute( #value2.AsString ))
Use Builtin(MESSAGE_BOX_ADD) With_Args(('value3: &1').substitute( #value3.AsString ))
Use Builtin(MESSAGE_BOX_SHOW)
Results in:
2023-01-24 10_45_48-Window.jpg
2023-01-24 10_45_48-Window.jpg (4.29 KiB) Viewed 36846 times
I would expect for the evaluation to take place, and after that the result being assigned to all 3 values. But it looks like it's evaluated like:

Value1 := 1 + 2 + 3
Value2 := 6 + 2 + 3
Value3 := 6 + 11 + 3

Is this as designed, or is this a bug?

Re: As designed or a bug?

Posted: Tue Jan 24, 2023 11:48 pm
by René Houba
Hi Peter,

Tis is "as desgned" I think. I saw same issues likes this in the past.

I will check for you.

Re: As designed or a bug?

Posted: Wed Jan 25, 2023 12:02 am
by Theo de Bruin
This is the normal way the evaluation is done, once value1 is changed, the next eveluation will use the new value.

Re: As designed or a bug?

Posted: Wed Jan 25, 2023 12:37 am
by pkoopmanpk
Theo de Bruin wrote: Wed Jan 25, 2023 12:02 am This is the normal way the evaluation is done, once value1 is changed, the next eveluation will use the new value.
Thanks. Good to know that ASSIGN is executed for each variable in the list separately. The documentation doesn't mention this.