Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Temporary assignments to map or array members leave them always set to $nil #1515

Closed
hanche opened this issue Apr 5, 2022 · 0 comments
Closed
Labels
Milestone

Comments

@hanche
Copy link
Contributor

hanche commented Apr 5, 2022

I honestly don't know what should happen when you temporarily assign to a map or array member, but all these results seem wrong, or at least surprising:

Exhibit 1:

⬥ var x = [&y=1]
⬥ { tmp x[y] = 2; put $x }
⮕ [&y=2]
⬥ put $x
⮕ [&y=$nil]

Exhibit 2:

⬥ var x = [&y=1]
⬥ { tmp x[z] = 2; put $x }
⮕ [&y=1 &z=2]
⬥ put $x
⮕ [&y=1 &z=$nil]

Exhibit 3:

⬥ var x = [1 2 3]
⬥ { tmp x[1] = 9; put $x }
⮕ [1 9 3]
⬥ put $x
⮕ [1 $nil 3]
@xiaq xiaq added the bug label Jun 7, 2022
@xiaq xiaq changed the title Temporary assignments to map or array members produce odd results Temporary assignments to map or array members leave them always set to $nil Jun 7, 2022
@xiaq xiaq added this to the 0.19.0 milestone Jun 7, 2022
@xiaq xiaq closed this as completed in e211d02 Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants