v icon indicating copy to clipboard operation
v copied to clipboard

vsh: cannot use constants from auto-imported modules

Open serkonda7 opened this issue 5 years ago • 4 comments

V version: V 0.1.29 01b28ef OS: Manjaro

What did you do?

// script.vsh
println(path_separator)

What did you expect to see? Output of /

What did you see instead?

[...] error: undefined ident: `path_separator`
[...]

serkonda7 avatar Sep 14 '20 19:09 serkonda7

You can use it, but have to explicitely say it is from the os module as : os.path_separator. Do you wish to be able to use the variable without the os. part ?

Henrixounez avatar Sep 21 '20 07:09 Henrixounez

Yes, I do not need to type os. before functions, so I don't expect to need it for constants too.

serkonda7 avatar Sep 21 '20 10:09 serkonda7

@spytheman how should this behave? 🤔

danieldaeschle avatar Jul 21 '21 14:07 danieldaeschle

The auto-import of os seems nice, but is it really? Audience for .vsh scripts probertly also code normal v and are used to import, so why not just do that? I suggest do keep the auto os import as is for compatibility, but alter vsh description to discourage the practice of use autoimport.

martinskou avatar May 16 '25 11:05 martinskou