* documents #21628

* Update doc/manual.md

---------

Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
This commit is contained in:
Juan M Gómez
2023-04-24 17:09:07 +01:00
committed by GitHub
parent 4754c51f1b
commit 897dff69dd

View File

@@ -6889,6 +6889,35 @@ iterator in which case the overloading resolution takes place:
var x = 4
write(stdout, x) # not ambiguous: uses the module C's x
```
Modules can share their name, however, when trying to qualify a identifier with the module name the compiler will fail with ambiguous identifier error. One can qualify the identifier by aliasing the module.
```nim
# Module A/C
proc fb* = echo "fizz"
```
```nim
# Module B/C
proc fb* = echo "buzz"
```
```nim
import A/C
import B/C
C.fb() # Error: ambiguous identifier: 'fb'
```
```nim
import A/C as fizz
import B/C
fizz.fb() # Works
```
Packages