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

array.pop() ineffective in repl without attribution of the result #21788

Closed
davlgd opened this issue Jul 2, 2024 · 0 comments · Fixed by #21792
Closed

array.pop() ineffective in repl without attribution of the result #21788

davlgd opened this issue Jul 2, 2024 · 0 comments · Fixed by #21792
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@davlgd
Copy link
Contributor

davlgd commented Jul 2, 2024

Describe the bug

If I use array.pop() in the repl, it's not effective except if the result is attributed to a variable.

Reproduction Steps

In the V repl, I get this:

>>> mut values := [1, 2, 3]
>>> values.pop()
3
>>> values
[1, 2, 3]
>>> removed := values.pop()
>>> values
[1, 2]

In a V application, it's ok:

fn main() {
	mut values := [1, 2, 3]
	println('before: ${values}')
	values.pop()
	println('after: ${values}')
}
v run main.v
before: [1, 2, 3]
after: [1, 2]

Expected Behavior

Get the same behavior from code and repl

Current Behavior

In the repl, values.pop() is ineffective, removed := values.pop() is ok

Possible Solution

No response

Additional Information/Context

No response

V version

0.4.6 c412b9f

Environment details (OS name and version, etc.)

V full version: V 0.4.6 c412b9f
OS: macos, macOS, 14.5, 23F79
Processor: 12 cpus, 64bit, little endian, Apple M3 Pro

getwd: /Users/davlgd/Documents/code/clever/vTest
vexe: /opt/homebrew/Cellar/vlang/0.4.6_1/libexec/v
vexe mtime: 2024-05-20 18:06:54

vroot: OK, value: /opt/homebrew/Cellar/vlang/0.4.6_1/libexec
VMODULES: OK, value: /Users/davlgd/.vmodules
VTMP: OK, value: /tmp/v_501

Git version: git version 2.39.3 (Apple Git-146)
Git vroot status: 4.3.7 (58345 commit(s) behind V master)
.git/config present: false

CC version: Apple clang version 15.0.0 (clang-1500.3.9.4)
thirdparty/tcc: N/A

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@davlgd davlgd added the Bug This tag is applied to issues which reports bugs. label Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant