diff options
author | Juan M Gómez <info@jmgomez.me> | 2023-04-24 17:09:07 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-24 18:09:07 +0200 |
commit | 897dff69dd3a284adb94392b085577068f792a1c (patch) | |
tree | eb61638ecbe3fd67e1af9b3dac4451bdf2211ce6 | |
parent | 4754c51f1b7225d061b03688c93ff15d4b625ec6 (diff) | |
download | Nim-897dff69dd3a284adb94392b085577068f792a1c.tar.gz |
documents #21628 (#21723)
* documents #21628 * Update doc/manual.md --------- Co-authored-by: Andreas Rumpf <rumpf_a@web.de>
-rw-r--r-- | doc/manual.md | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/doc/manual.md b/doc/manual.md index c381ab410..31e69d0ac 100644 --- a/doc/manual.md +++ b/doc/manual.md @@ -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 |