You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
⬥ var a = x
⬥ var a = [$a $a] ##
⬥ put $a
⮕ [$nil $nil]
Expected result should be [x x].
Clearly, the problem is that the right hand side of the assignment (marked ## in the above code) is within the scope of the variable being declared.
I think the correct behaviour (for some value of “correct” is to first evaluate the right hand side of the assignment, then create the new variable(s) and perform the assignment.
Others may disagree, and some may argue that this is a feature request rather than a bug. But if so, it is at least a documentation bug, since the exact behaviour is not documented.
What happened, and what did you expect to happen?
What happens:
Expected result should be
[x x]
.Clearly, the problem is that the right hand side of the assignment (marked
##
in the above code) is within the scope of the variable being declared.I think the correct behaviour (for some value of “correct” is to first evaluate the right hand side of the assignment, then create the new variable(s) and perform the assignment.
Others may disagree, and some may argue that this is a feature request rather than a bug. But if so, it is at least a documentation bug, since the exact behaviour is not documented.
Output of "elvish -version"
0.21.0-dev.0.20240724150116-9597a25e366b-dirty
Code of Conduct
The text was updated successfully, but these errors were encountered: