Closed kaushalmodi closed 4 years ago
We have to do the same thing in nimble as well today.
https://github.com/nim-lang/nimble/blob/master/src/nimblepkg/nimscriptwrapper.nim#L118
Not a bug? Even outside of nimscript, name clashes are possible and you need to use qualified names.
Even outside of nimscript, name clashes are possible and you need to use qualified names.
Is this a slightly different case though?
The name clashes are understood when the they happen among two or more user-imported modules.
In this case, it happens between the implicitly imported system and user imported os.
I believe there was already an internal way in the packages to determine if an stdlib module is imported in a NimScript. If so, something special can probably done to prevent this name clash on doing import os
.
os
defines param*
as error for nimscript and other targets.
Error: unhandled exception: paramCount is not implemented on Nintendo Switch [OSError]
this is clearly not right.
@kaushalmodi https://github.com/nim-lang/Nim/pull/12860
Please send similar PR for any more such issue :)
@nc-x Thank you for working on a PR to fix this!
I would have liked to send a PR to fix this myself, but looking at your PR, I don't think I would have been able to make those fixes myself. But I am always trying ..
@kaushalmodi the original PR was much simpler. It just removed the proc declarations from os.nim for nimscript. And it passed all the tests, unlike now :)
In
config.nims
, when theos
module is imported andparamCount
and/orparamStr
are used, we get the "ambiguous call" error (because these two are defined in bothsystem
andos
.Example
config.nims
Current Output
Expected Output
No error
Workaround
import os except paramCount, paramStr
, orsystem.
qualifiers with the ambiguous identifiers.Additional Information
This used to work at some point (probably around Nim 19.x).