I wanted to overwrite an existing variable of type table by the one returned from a call to a proc().
But it does not work, unless eval() is called on the returned result from the proc()
But if the variable that recieves the return value from the proc() was not already a table type, then it works without using eval. Why is that?
Here is an example
A["c"]:=3; #add new field
table(["a" = 1, "c" = 3, "b" = 2])
In the above, it worked. B is table now, and assigned the updated table from the proc. But
A:=foo(A): #without eval, it does not work.
I expected A to be overwritten, just like B was. To fix this, I have to change A:=foo(A): by A:=eval(foo(A)):
But why eval was not needed in the first example, and was needed for the second example?
btw, the same thing happens with Record(), not just table()
just like to understand the reasoning behind this. I expected both cases to work the same way. But it works different if the variable happend to be unassigned (like B above).