v
v copied to clipboard
vsh: Cannot use `os` constants without importing `os`
Describe the bug
In a .vsh file, the module os is currently imported with all of the functions being global so you don't need to import it. Using constants from the module, however, does not work without having to import os.
Expected Behavior
I expected println(args) to print the arguments provided
Current Behavior
println(args) currently errors with
test.vsh:1:9: error: undefined ident: `args`
1 | println(args)
| ~~~~
Reproduction Steps
In a .vsh file (or extension-less)
println(args)
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.3.3 6b20c57.ac381f5
Environment details (OS name and version, etc.)
OS: linux, "Arch Linux"
Processor: 16 cpus, 64bit, little endian, AMD Ryzen 9 5900HX with Radeon Graphics
CC version: cc (GCC) 12.2.1 20230201
getwd: /home/user/Workspaces/V/bug-testing
vmodules: /home/user/.vmodules
vroot: /home/user/v
vexe: /home/user/v/v
vexe mtime: 2023-02-10 21:12:47
is vroot writable: true
is vmodules writable: true
V full version: V 0.3.3 6b20c57.ac381f5
Git version: git version 2.39.1
Git vroot status: 0.3.3-60-gac381f5e
.git/config present: true
thirdparty/tcc status: thirdparty-linux-amd64 12f392c3
? println(os.args)?
I am not sure if .vsh files should allow the implicit import of os module variables/constants.
?
println(os.args)?
This doesn't work.
println(os.args)
test.vsh:1:9: error: undefined ident: `os`
1 | println(os.args)
| ~~
I am not sure if
.vshfiles should allow the implicit import of os module variables/constants.
Agreed, as it could have unintended consequences, but it should still warn the user that constants are not implicitly imported. (suggesting importing os, maybe?)