Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).
import ./j
import ./e
proc u(d: int | int) =
var r: Y
static: doAssert r is j.Y # because j is imported first
doAssert r is j.Y
u(0)
j.nim and e.nim:
type Y* = object
nim c m
Nim Version
Nim Compiler Version 1.6.21 [Linux: amd64]
Compiled at 2024-04-17
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 8ebb4dc30af3a5d3dd14bc651698d02b715befed
active boot switches: -d:release
Nim Compiler Version 2.0.5 [Linux: amd64]
Compiled at 2024-04-17
Copyright (c) 2006-2023 by Andreas Rumpf
git hash: 3ad16028aae82aa7cc48e72744890dd3fe504796
active boot switches: -d:release
Nim Compiler Version 2.1.1 [Linux: amd64]
Compiled at 2024-04-17
Copyright (c) 2006-2024 by Andreas Rumpf
git hash: 49e1ca0b3e53709b993f63288a164cd843c70c82
active boot switches: -d:release
Current Output
Builds with
m.nim(2, 8) Warning: imported and not used: 'e' [UnusedImport]
Expected Output
Does not build, because it does not have enough information to disambiguate which Y symbol it should use. Replacing proc with template, or with a non-generic proc, shows
m.nim(5, 10) Error: ambiguous identifier: 'Y' -- use one of the following:
j.Y: Y
e.Y: Y
Description
m.nim
:j.nim
ande.nim
:nim c m
Nim Version
Current Output
Expected Output
Possible Solution
No response
Additional Information
No response